Tikz – Box/frame arround Text with interruptionTikZ: Cropping the Bounding BoxHow can I put a coloured outline around fraction lines?How to define the default vertical distance between nodes?Why do I get an extra white page before my TikZ picture?TikZ: Drawing an arc from an intersection to an intersectionHow can I write in a box with fixed height?Adjust text spacing in tikz boxTikz for drawing box flowchartAdd a box around text
Has Matt Bevin explained his reasoning for the pardons he has recently issued?
How do I override the $message value of the UniqueFieldConstraint class?
Why aren't we seeing carbon taxes in practice?
Can a public school in the USA force a 14yr old to create a Twitter account for a passing grade?
Obtaining optimality gaps when using hybrid exact-heuristic approaches to vehicle routing problems
Eating Titan's oceans
Why are the out of bounds areas of doom distorted on MSDOS?
Sugar daddy wants me to apply for a credit card so he can link me to his company account. Suspicious or am I being paranoid?
Simulating a scale, balancing weight from lists
smallest number obtainable from 2020
Vulcan Anatomy (Heart)
Am I being scammed by a sugar daddy who wants me to buy wallet cards and forward paypal money?
What is a Brown Bag Seminar?
Which was the first story to feature force fields?
Has any person or company ever become a sovereign state?
Can salted butter be used to make lemon curd?
Why does one mostly fall backward when slipping?
Sometimes the updated rows are not locked within instead of update trigger
Is verificationism dead?
How do I escape from a hanging Ubuntu OS?
Reduction of Meijer G-function
5yrs old being bossy... Is this too much or tolerable at this age?
How do I self-answer "What does this say?"
How to I represent 5 eighth-notes as one note?
Tikz – Box/frame arround Text with interruption
TikZ: Cropping the Bounding BoxHow can I put a coloured outline around fraction lines?How to define the default vertical distance between nodes?Why do I get an extra white page before my TikZ picture?TikZ: Drawing an arc from an intersection to an intersectionHow can I write in a box with fixed height?Adjust text spacing in tikz boxTikz for drawing box flowchartAdd a box around text
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
does somebody know a trick for creating a box/frame lite this around a text like this:
I guess it could be working best with tikz
. Here is the code for the text (without frame):
documentclassarticle
usepackagefix-cm
usepackagexcolor
begindocument
vspace*3cm
begincenter
fontsize2510 sffamily colorblack!45 Name xy
vspace.5cm
fontsize7510 sffamily colorred 2019
vspace.5cm
fontsize2510 sffamily colorblack!45 Name
endcenter
enddocument
tikz-pgf box
add a comment
|
does somebody know a trick for creating a box/frame lite this around a text like this:
I guess it could be working best with tikz
. Here is the code for the text (without frame):
documentclassarticle
usepackagefix-cm
usepackagexcolor
begindocument
vspace*3cm
begincenter
fontsize2510 sffamily colorblack!45 Name xy
vspace.5cm
fontsize7510 sffamily colorred 2019
vspace.5cm
fontsize2510 sffamily colorblack!45 Name
endcenter
enddocument
tikz-pgf box
add a comment
|
does somebody know a trick for creating a box/frame lite this around a text like this:
I guess it could be working best with tikz
. Here is the code for the text (without frame):
documentclassarticle
usepackagefix-cm
usepackagexcolor
begindocument
vspace*3cm
begincenter
fontsize2510 sffamily colorblack!45 Name xy
vspace.5cm
fontsize7510 sffamily colorred 2019
vspace.5cm
fontsize2510 sffamily colorblack!45 Name
endcenter
enddocument
tikz-pgf box
does somebody know a trick for creating a box/frame lite this around a text like this:
I guess it could be working best with tikz
. Here is the code for the text (without frame):
documentclassarticle
usepackagefix-cm
usepackagexcolor
begindocument
vspace*3cm
begincenter
fontsize2510 sffamily colorblack!45 Name xy
vspace.5cm
fontsize7510 sffamily colorred 2019
vspace.5cm
fontsize2510 sffamily colorblack!45 Name
endcenter
enddocument
tikz-pgf box
tikz-pgf box
asked Oct 1 at 13:45
simandesimande
4193 silver badges9 bronze badges
4193 silver badges9 bronze badges
add a comment
|
add a comment
|
2 Answers
2
active
oldest
votes
Something like this? The vertical distances are controlled by inner ysep
, and the horizontal ones by inner xsep
.
documentclass[tikz,border=3mm]standalone
begindocument
begintikzpicture[font=sffamilybfseries]
node[scale=4,red!60,inner xsep=1.5ex,inner ysep=0.5ex] (2019)2019;
node[above,scale=2,gray!50] at (2019.north) (A) Name xy;
node[below,scale=2,gray!50] at (2019.south) (B) Name;
draw[thick,gray!50] (A.east) -| (2019.east|-B) -- (B.east)
(A.west) -| (2019.west|-B) -- (B.west);
endtikzpicture
enddocument
exactly like this. Thanks a lot!
– simande
Oct 1 at 14:42
how about this?documentclass[tikz,border=1mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=2,violet,draw=gray!50,line width=2pt,rounded corners, inner xsep=2mm,inner ysep=2mm] (2019) 2019 (2019.north) node[orange,fill=white] TikZ (2019.south) node[orange,fill=white] texSE; endtikzpicture enddocument
– Black Mild
Oct 1 at 15:45
1
@BlackMild Thanks! This also works for white backgrounds. It won't look good if the thing is put on a non-white background, though.
– Schrödinger's cat
Oct 1 at 15:47
I just modified from your code. For colored background, say, pink, then just put [fill=pink]. Still there is a problem: I can not adjust texSE in the middle of boundary of the node2019
.
– Black Mild
Oct 1 at 15:51
2
@BlackMild You can dodocumentclass[tikz,border=3mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=4,red,inner xsep=1.5ex,inner ysep=2ex,draw=black!45,thick] (2019)2019 (2019.north) node[scale=2,text=black!45,fill=white,text depth=0pt] Name xy (2019.south) node[scale=2,text=black!45,fill=white,text depth=0pt] Name; endtikzpicture enddocument
but why? It only works for monochrome backgrounds.
– Schrödinger's cat
Oct 1 at 16:03
add a comment
|
Just for fun a TikZ-less version, that only uses xcolor
and grabbox
(grabbox
wouldn't really be necessary, but this way you can use verb
and stuff in the braced arguments).
Argument structure of boxtext
is:
- optional argument specifying fixed width of top-text
- mandatory argument for top-text
- optional argument specifying fixed width of main-text
- mandatory argument for main-text
- optional argument specifying fixed width of bottom-text
- mandatory argument for bottom-text
If you don't specify a fixed width the natural width is used, if a fixed width is specified the contents will be centred using centering
.
documentclass[]article
usepackagexcolor
usepackagegrabbox
makeatletter
colorletboxtextbordergray
newlengthtoptextpad
newlengthmaintextpad
newlengthbottomtextpad
newlengthboxtextborder
setlengthtoptextpad2pt
setlengthmaintextpad5pt
setlengthbottomtextpad2pt
setlengthboxtextborder.4pt
newlengthboxtext@maxwd
newsaveboxboxtext@toptext
newsaveboxboxtext@maintext
newsaveboxboxtext@bottomtext
defmyfi@Tbfi#1#2#3fi#2
newcommandboxtext@ifrelax[1]
%
ifxrelax#1%
myfi@Tb
fi
@secondoftwo
newcommandboxtext[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@toptextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@toptextcolorboxtextbordervbox%
boxtext@a
newcommandboxtext@a[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@maintexthbox
@grabboxhsize#1centeringboxtext@maintextvbox%
boxtext@b
newcommandboxtext@b[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@bottomtextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@bottomtextcolorboxtextbordervbox%
boxtext@out
newcommand*boxtext@siderule
%
vrule
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
width boxtextborder
relax
newcommand*boxtext@toprule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@toptext)/2-toptextpad
relax
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
-dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad-.5boxtextborder
relax
relax
newcommand*boxtext@bottomrule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@bottomtext)/2-bottomtextpad
relax
height
-dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad-.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
relax
newcommand*boxtext@out
%
mbox
%
begingroup
ifdimwdboxtext@maintext>wdboxtext@toptext
ifdimwdboxtext@maintext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@maintext
else
boxtext@maxwdwdboxtext@bottomtext
fi
else
ifdimwdboxtext@toptext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@toptext
else
boxtext@maxwdwdboxtext@bottomtext
fi
fi
advanceboxtext@maxwd2maintextpad
colorboxtextborder%
boxtext@siderule
rlapmakebox[boxtext@maxwd][c]useboxboxtext@maintext%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
dimexpr
htboxtext@maintext+dpboxtext@toptext
+maintextpad+toptextpad
useboxboxtext@toptext%
%
%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
-dimexpr
dpboxtext@maintext+htboxtext@bottomtext
+maintextpad+bottomtextpad
useboxboxtext@bottomtext%
%
%
rlapboxtext@toprule%
rlapboxtext@bottomrule%
hskipboxtext@maxwd
llapboxtext@toprule%
llapboxtext@bottomrule%
boxtext@siderule
endgroup
%
makeatother
begindocument
boxtext
Name xy
textcolorred2019
Name%
boxtext
textsfName xy
sffamilybfserieshugetextcolorred2019
textsfName
boxtextName xy[5cm]This is some text that is 5cm wideName
enddocument
haha, ok that works as well ;-)
– simande
Oct 1 at 14:54
1
@simande and it's only 153 lines of code to create theboxtext
macro, so definitely the way to go!
– Skillmon
Oct 1 at 14:55
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f510533%2ftikz-box-frame-arround-text-with-interruption%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Something like this? The vertical distances are controlled by inner ysep
, and the horizontal ones by inner xsep
.
documentclass[tikz,border=3mm]standalone
begindocument
begintikzpicture[font=sffamilybfseries]
node[scale=4,red!60,inner xsep=1.5ex,inner ysep=0.5ex] (2019)2019;
node[above,scale=2,gray!50] at (2019.north) (A) Name xy;
node[below,scale=2,gray!50] at (2019.south) (B) Name;
draw[thick,gray!50] (A.east) -| (2019.east|-B) -- (B.east)
(A.west) -| (2019.west|-B) -- (B.west);
endtikzpicture
enddocument
exactly like this. Thanks a lot!
– simande
Oct 1 at 14:42
how about this?documentclass[tikz,border=1mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=2,violet,draw=gray!50,line width=2pt,rounded corners, inner xsep=2mm,inner ysep=2mm] (2019) 2019 (2019.north) node[orange,fill=white] TikZ (2019.south) node[orange,fill=white] texSE; endtikzpicture enddocument
– Black Mild
Oct 1 at 15:45
1
@BlackMild Thanks! This also works for white backgrounds. It won't look good if the thing is put on a non-white background, though.
– Schrödinger's cat
Oct 1 at 15:47
I just modified from your code. For colored background, say, pink, then just put [fill=pink]. Still there is a problem: I can not adjust texSE in the middle of boundary of the node2019
.
– Black Mild
Oct 1 at 15:51
2
@BlackMild You can dodocumentclass[tikz,border=3mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=4,red,inner xsep=1.5ex,inner ysep=2ex,draw=black!45,thick] (2019)2019 (2019.north) node[scale=2,text=black!45,fill=white,text depth=0pt] Name xy (2019.south) node[scale=2,text=black!45,fill=white,text depth=0pt] Name; endtikzpicture enddocument
but why? It only works for monochrome backgrounds.
– Schrödinger's cat
Oct 1 at 16:03
add a comment
|
Something like this? The vertical distances are controlled by inner ysep
, and the horizontal ones by inner xsep
.
documentclass[tikz,border=3mm]standalone
begindocument
begintikzpicture[font=sffamilybfseries]
node[scale=4,red!60,inner xsep=1.5ex,inner ysep=0.5ex] (2019)2019;
node[above,scale=2,gray!50] at (2019.north) (A) Name xy;
node[below,scale=2,gray!50] at (2019.south) (B) Name;
draw[thick,gray!50] (A.east) -| (2019.east|-B) -- (B.east)
(A.west) -| (2019.west|-B) -- (B.west);
endtikzpicture
enddocument
exactly like this. Thanks a lot!
– simande
Oct 1 at 14:42
how about this?documentclass[tikz,border=1mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=2,violet,draw=gray!50,line width=2pt,rounded corners, inner xsep=2mm,inner ysep=2mm] (2019) 2019 (2019.north) node[orange,fill=white] TikZ (2019.south) node[orange,fill=white] texSE; endtikzpicture enddocument
– Black Mild
Oct 1 at 15:45
1
@BlackMild Thanks! This also works for white backgrounds. It won't look good if the thing is put on a non-white background, though.
– Schrödinger's cat
Oct 1 at 15:47
I just modified from your code. For colored background, say, pink, then just put [fill=pink]. Still there is a problem: I can not adjust texSE in the middle of boundary of the node2019
.
– Black Mild
Oct 1 at 15:51
2
@BlackMild You can dodocumentclass[tikz,border=3mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=4,red,inner xsep=1.5ex,inner ysep=2ex,draw=black!45,thick] (2019)2019 (2019.north) node[scale=2,text=black!45,fill=white,text depth=0pt] Name xy (2019.south) node[scale=2,text=black!45,fill=white,text depth=0pt] Name; endtikzpicture enddocument
but why? It only works for monochrome backgrounds.
– Schrödinger's cat
Oct 1 at 16:03
add a comment
|
Something like this? The vertical distances are controlled by inner ysep
, and the horizontal ones by inner xsep
.
documentclass[tikz,border=3mm]standalone
begindocument
begintikzpicture[font=sffamilybfseries]
node[scale=4,red!60,inner xsep=1.5ex,inner ysep=0.5ex] (2019)2019;
node[above,scale=2,gray!50] at (2019.north) (A) Name xy;
node[below,scale=2,gray!50] at (2019.south) (B) Name;
draw[thick,gray!50] (A.east) -| (2019.east|-B) -- (B.east)
(A.west) -| (2019.west|-B) -- (B.west);
endtikzpicture
enddocument
Something like this? The vertical distances are controlled by inner ysep
, and the horizontal ones by inner xsep
.
documentclass[tikz,border=3mm]standalone
begindocument
begintikzpicture[font=sffamilybfseries]
node[scale=4,red!60,inner xsep=1.5ex,inner ysep=0.5ex] (2019)2019;
node[above,scale=2,gray!50] at (2019.north) (A) Name xy;
node[below,scale=2,gray!50] at (2019.south) (B) Name;
draw[thick,gray!50] (A.east) -| (2019.east|-B) -- (B.east)
(A.west) -| (2019.west|-B) -- (B.west);
endtikzpicture
enddocument
answered Oct 1 at 13:58
Schrödinger's catSchrödinger's cat
31.9k2 gold badges45 silver badges72 bronze badges
31.9k2 gold badges45 silver badges72 bronze badges
exactly like this. Thanks a lot!
– simande
Oct 1 at 14:42
how about this?documentclass[tikz,border=1mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=2,violet,draw=gray!50,line width=2pt,rounded corners, inner xsep=2mm,inner ysep=2mm] (2019) 2019 (2019.north) node[orange,fill=white] TikZ (2019.south) node[orange,fill=white] texSE; endtikzpicture enddocument
– Black Mild
Oct 1 at 15:45
1
@BlackMild Thanks! This also works for white backgrounds. It won't look good if the thing is put on a non-white background, though.
– Schrödinger's cat
Oct 1 at 15:47
I just modified from your code. For colored background, say, pink, then just put [fill=pink]. Still there is a problem: I can not adjust texSE in the middle of boundary of the node2019
.
– Black Mild
Oct 1 at 15:51
2
@BlackMild You can dodocumentclass[tikz,border=3mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=4,red,inner xsep=1.5ex,inner ysep=2ex,draw=black!45,thick] (2019)2019 (2019.north) node[scale=2,text=black!45,fill=white,text depth=0pt] Name xy (2019.south) node[scale=2,text=black!45,fill=white,text depth=0pt] Name; endtikzpicture enddocument
but why? It only works for monochrome backgrounds.
– Schrödinger's cat
Oct 1 at 16:03
add a comment
|
exactly like this. Thanks a lot!
– simande
Oct 1 at 14:42
how about this?documentclass[tikz,border=1mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=2,violet,draw=gray!50,line width=2pt,rounded corners, inner xsep=2mm,inner ysep=2mm] (2019) 2019 (2019.north) node[orange,fill=white] TikZ (2019.south) node[orange,fill=white] texSE; endtikzpicture enddocument
– Black Mild
Oct 1 at 15:45
1
@BlackMild Thanks! This also works for white backgrounds. It won't look good if the thing is put on a non-white background, though.
– Schrödinger's cat
Oct 1 at 15:47
I just modified from your code. For colored background, say, pink, then just put [fill=pink]. Still there is a problem: I can not adjust texSE in the middle of boundary of the node2019
.
– Black Mild
Oct 1 at 15:51
2
@BlackMild You can dodocumentclass[tikz,border=3mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=4,red,inner xsep=1.5ex,inner ysep=2ex,draw=black!45,thick] (2019)2019 (2019.north) node[scale=2,text=black!45,fill=white,text depth=0pt] Name xy (2019.south) node[scale=2,text=black!45,fill=white,text depth=0pt] Name; endtikzpicture enddocument
but why? It only works for monochrome backgrounds.
– Schrödinger's cat
Oct 1 at 16:03
exactly like this. Thanks a lot!
– simande
Oct 1 at 14:42
exactly like this. Thanks a lot!
– simande
Oct 1 at 14:42
how about this?
documentclass[tikz,border=1mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=2,violet,draw=gray!50,line width=2pt,rounded corners, inner xsep=2mm,inner ysep=2mm] (2019) 2019 (2019.north) node[orange,fill=white] TikZ (2019.south) node[orange,fill=white] texSE; endtikzpicture enddocument
– Black Mild
Oct 1 at 15:45
how about this?
documentclass[tikz,border=1mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=2,violet,draw=gray!50,line width=2pt,rounded corners, inner xsep=2mm,inner ysep=2mm] (2019) 2019 (2019.north) node[orange,fill=white] TikZ (2019.south) node[orange,fill=white] texSE; endtikzpicture enddocument
– Black Mild
Oct 1 at 15:45
1
1
@BlackMild Thanks! This also works for white backgrounds. It won't look good if the thing is put on a non-white background, though.
– Schrödinger's cat
Oct 1 at 15:47
@BlackMild Thanks! This also works for white backgrounds. It won't look good if the thing is put on a non-white background, though.
– Schrödinger's cat
Oct 1 at 15:47
I just modified from your code. For colored background, say, pink, then just put [fill=pink]. Still there is a problem: I can not adjust texSE in the middle of boundary of the node
2019
.– Black Mild
Oct 1 at 15:51
I just modified from your code. For colored background, say, pink, then just put [fill=pink]. Still there is a problem: I can not adjust texSE in the middle of boundary of the node
2019
.– Black Mild
Oct 1 at 15:51
2
2
@BlackMild You can do
documentclass[tikz,border=3mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=4,red,inner xsep=1.5ex,inner ysep=2ex,draw=black!45,thick] (2019)2019 (2019.north) node[scale=2,text=black!45,fill=white,text depth=0pt] Name xy (2019.south) node[scale=2,text=black!45,fill=white,text depth=0pt] Name; endtikzpicture enddocument
but why? It only works for monochrome backgrounds.– Schrödinger's cat
Oct 1 at 16:03
@BlackMild You can do
documentclass[tikz,border=3mm]standalone begindocument begintikzpicture[font=sffamilybfseries] path node[scale=4,red,inner xsep=1.5ex,inner ysep=2ex,draw=black!45,thick] (2019)2019 (2019.north) node[scale=2,text=black!45,fill=white,text depth=0pt] Name xy (2019.south) node[scale=2,text=black!45,fill=white,text depth=0pt] Name; endtikzpicture enddocument
but why? It only works for monochrome backgrounds.– Schrödinger's cat
Oct 1 at 16:03
add a comment
|
Just for fun a TikZ-less version, that only uses xcolor
and grabbox
(grabbox
wouldn't really be necessary, but this way you can use verb
and stuff in the braced arguments).
Argument structure of boxtext
is:
- optional argument specifying fixed width of top-text
- mandatory argument for top-text
- optional argument specifying fixed width of main-text
- mandatory argument for main-text
- optional argument specifying fixed width of bottom-text
- mandatory argument for bottom-text
If you don't specify a fixed width the natural width is used, if a fixed width is specified the contents will be centred using centering
.
documentclass[]article
usepackagexcolor
usepackagegrabbox
makeatletter
colorletboxtextbordergray
newlengthtoptextpad
newlengthmaintextpad
newlengthbottomtextpad
newlengthboxtextborder
setlengthtoptextpad2pt
setlengthmaintextpad5pt
setlengthbottomtextpad2pt
setlengthboxtextborder.4pt
newlengthboxtext@maxwd
newsaveboxboxtext@toptext
newsaveboxboxtext@maintext
newsaveboxboxtext@bottomtext
defmyfi@Tbfi#1#2#3fi#2
newcommandboxtext@ifrelax[1]
%
ifxrelax#1%
myfi@Tb
fi
@secondoftwo
newcommandboxtext[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@toptextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@toptextcolorboxtextbordervbox%
boxtext@a
newcommandboxtext@a[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@maintexthbox
@grabboxhsize#1centeringboxtext@maintextvbox%
boxtext@b
newcommandboxtext@b[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@bottomtextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@bottomtextcolorboxtextbordervbox%
boxtext@out
newcommand*boxtext@siderule
%
vrule
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
width boxtextborder
relax
newcommand*boxtext@toprule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@toptext)/2-toptextpad
relax
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
-dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad-.5boxtextborder
relax
relax
newcommand*boxtext@bottomrule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@bottomtext)/2-bottomtextpad
relax
height
-dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad-.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
relax
newcommand*boxtext@out
%
mbox
%
begingroup
ifdimwdboxtext@maintext>wdboxtext@toptext
ifdimwdboxtext@maintext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@maintext
else
boxtext@maxwdwdboxtext@bottomtext
fi
else
ifdimwdboxtext@toptext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@toptext
else
boxtext@maxwdwdboxtext@bottomtext
fi
fi
advanceboxtext@maxwd2maintextpad
colorboxtextborder%
boxtext@siderule
rlapmakebox[boxtext@maxwd][c]useboxboxtext@maintext%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
dimexpr
htboxtext@maintext+dpboxtext@toptext
+maintextpad+toptextpad
useboxboxtext@toptext%
%
%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
-dimexpr
dpboxtext@maintext+htboxtext@bottomtext
+maintextpad+bottomtextpad
useboxboxtext@bottomtext%
%
%
rlapboxtext@toprule%
rlapboxtext@bottomrule%
hskipboxtext@maxwd
llapboxtext@toprule%
llapboxtext@bottomrule%
boxtext@siderule
endgroup
%
makeatother
begindocument
boxtext
Name xy
textcolorred2019
Name%
boxtext
textsfName xy
sffamilybfserieshugetextcolorred2019
textsfName
boxtextName xy[5cm]This is some text that is 5cm wideName
enddocument
haha, ok that works as well ;-)
– simande
Oct 1 at 14:54
1
@simande and it's only 153 lines of code to create theboxtext
macro, so definitely the way to go!
– Skillmon
Oct 1 at 14:55
add a comment
|
Just for fun a TikZ-less version, that only uses xcolor
and grabbox
(grabbox
wouldn't really be necessary, but this way you can use verb
and stuff in the braced arguments).
Argument structure of boxtext
is:
- optional argument specifying fixed width of top-text
- mandatory argument for top-text
- optional argument specifying fixed width of main-text
- mandatory argument for main-text
- optional argument specifying fixed width of bottom-text
- mandatory argument for bottom-text
If you don't specify a fixed width the natural width is used, if a fixed width is specified the contents will be centred using centering
.
documentclass[]article
usepackagexcolor
usepackagegrabbox
makeatletter
colorletboxtextbordergray
newlengthtoptextpad
newlengthmaintextpad
newlengthbottomtextpad
newlengthboxtextborder
setlengthtoptextpad2pt
setlengthmaintextpad5pt
setlengthbottomtextpad2pt
setlengthboxtextborder.4pt
newlengthboxtext@maxwd
newsaveboxboxtext@toptext
newsaveboxboxtext@maintext
newsaveboxboxtext@bottomtext
defmyfi@Tbfi#1#2#3fi#2
newcommandboxtext@ifrelax[1]
%
ifxrelax#1%
myfi@Tb
fi
@secondoftwo
newcommandboxtext[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@toptextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@toptextcolorboxtextbordervbox%
boxtext@a
newcommandboxtext@a[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@maintexthbox
@grabboxhsize#1centeringboxtext@maintextvbox%
boxtext@b
newcommandboxtext@b[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@bottomtextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@bottomtextcolorboxtextbordervbox%
boxtext@out
newcommand*boxtext@siderule
%
vrule
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
width boxtextborder
relax
newcommand*boxtext@toprule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@toptext)/2-toptextpad
relax
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
-dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad-.5boxtextborder
relax
relax
newcommand*boxtext@bottomrule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@bottomtext)/2-bottomtextpad
relax
height
-dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad-.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
relax
newcommand*boxtext@out
%
mbox
%
begingroup
ifdimwdboxtext@maintext>wdboxtext@toptext
ifdimwdboxtext@maintext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@maintext
else
boxtext@maxwdwdboxtext@bottomtext
fi
else
ifdimwdboxtext@toptext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@toptext
else
boxtext@maxwdwdboxtext@bottomtext
fi
fi
advanceboxtext@maxwd2maintextpad
colorboxtextborder%
boxtext@siderule
rlapmakebox[boxtext@maxwd][c]useboxboxtext@maintext%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
dimexpr
htboxtext@maintext+dpboxtext@toptext
+maintextpad+toptextpad
useboxboxtext@toptext%
%
%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
-dimexpr
dpboxtext@maintext+htboxtext@bottomtext
+maintextpad+bottomtextpad
useboxboxtext@bottomtext%
%
%
rlapboxtext@toprule%
rlapboxtext@bottomrule%
hskipboxtext@maxwd
llapboxtext@toprule%
llapboxtext@bottomrule%
boxtext@siderule
endgroup
%
makeatother
begindocument
boxtext
Name xy
textcolorred2019
Name%
boxtext
textsfName xy
sffamilybfserieshugetextcolorred2019
textsfName
boxtextName xy[5cm]This is some text that is 5cm wideName
enddocument
haha, ok that works as well ;-)
– simande
Oct 1 at 14:54
1
@simande and it's only 153 lines of code to create theboxtext
macro, so definitely the way to go!
– Skillmon
Oct 1 at 14:55
add a comment
|
Just for fun a TikZ-less version, that only uses xcolor
and grabbox
(grabbox
wouldn't really be necessary, but this way you can use verb
and stuff in the braced arguments).
Argument structure of boxtext
is:
- optional argument specifying fixed width of top-text
- mandatory argument for top-text
- optional argument specifying fixed width of main-text
- mandatory argument for main-text
- optional argument specifying fixed width of bottom-text
- mandatory argument for bottom-text
If you don't specify a fixed width the natural width is used, if a fixed width is specified the contents will be centred using centering
.
documentclass[]article
usepackagexcolor
usepackagegrabbox
makeatletter
colorletboxtextbordergray
newlengthtoptextpad
newlengthmaintextpad
newlengthbottomtextpad
newlengthboxtextborder
setlengthtoptextpad2pt
setlengthmaintextpad5pt
setlengthbottomtextpad2pt
setlengthboxtextborder.4pt
newlengthboxtext@maxwd
newsaveboxboxtext@toptext
newsaveboxboxtext@maintext
newsaveboxboxtext@bottomtext
defmyfi@Tbfi#1#2#3fi#2
newcommandboxtext@ifrelax[1]
%
ifxrelax#1%
myfi@Tb
fi
@secondoftwo
newcommandboxtext[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@toptextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@toptextcolorboxtextbordervbox%
boxtext@a
newcommandboxtext@a[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@maintexthbox
@grabboxhsize#1centeringboxtext@maintextvbox%
boxtext@b
newcommandboxtext@b[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@bottomtextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@bottomtextcolorboxtextbordervbox%
boxtext@out
newcommand*boxtext@siderule
%
vrule
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
width boxtextborder
relax
newcommand*boxtext@toprule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@toptext)/2-toptextpad
relax
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
-dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad-.5boxtextborder
relax
relax
newcommand*boxtext@bottomrule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@bottomtext)/2-bottomtextpad
relax
height
-dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad-.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
relax
newcommand*boxtext@out
%
mbox
%
begingroup
ifdimwdboxtext@maintext>wdboxtext@toptext
ifdimwdboxtext@maintext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@maintext
else
boxtext@maxwdwdboxtext@bottomtext
fi
else
ifdimwdboxtext@toptext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@toptext
else
boxtext@maxwdwdboxtext@bottomtext
fi
fi
advanceboxtext@maxwd2maintextpad
colorboxtextborder%
boxtext@siderule
rlapmakebox[boxtext@maxwd][c]useboxboxtext@maintext%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
dimexpr
htboxtext@maintext+dpboxtext@toptext
+maintextpad+toptextpad
useboxboxtext@toptext%
%
%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
-dimexpr
dpboxtext@maintext+htboxtext@bottomtext
+maintextpad+bottomtextpad
useboxboxtext@bottomtext%
%
%
rlapboxtext@toprule%
rlapboxtext@bottomrule%
hskipboxtext@maxwd
llapboxtext@toprule%
llapboxtext@bottomrule%
boxtext@siderule
endgroup
%
makeatother
begindocument
boxtext
Name xy
textcolorred2019
Name%
boxtext
textsfName xy
sffamilybfserieshugetextcolorred2019
textsfName
boxtextName xy[5cm]This is some text that is 5cm wideName
enddocument
Just for fun a TikZ-less version, that only uses xcolor
and grabbox
(grabbox
wouldn't really be necessary, but this way you can use verb
and stuff in the braced arguments).
Argument structure of boxtext
is:
- optional argument specifying fixed width of top-text
- mandatory argument for top-text
- optional argument specifying fixed width of main-text
- mandatory argument for main-text
- optional argument specifying fixed width of bottom-text
- mandatory argument for bottom-text
If you don't specify a fixed width the natural width is used, if a fixed width is specified the contents will be centred using centering
.
documentclass[]article
usepackagexcolor
usepackagegrabbox
makeatletter
colorletboxtextbordergray
newlengthtoptextpad
newlengthmaintextpad
newlengthbottomtextpad
newlengthboxtextborder
setlengthtoptextpad2pt
setlengthmaintextpad5pt
setlengthbottomtextpad2pt
setlengthboxtextborder.4pt
newlengthboxtext@maxwd
newsaveboxboxtext@toptext
newsaveboxboxtext@maintext
newsaveboxboxtext@bottomtext
defmyfi@Tbfi#1#2#3fi#2
newcommandboxtext@ifrelax[1]
%
ifxrelax#1%
myfi@Tb
fi
@secondoftwo
newcommandboxtext[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@toptextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@toptextcolorboxtextbordervbox%
boxtext@a
newcommandboxtext@a[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@maintexthbox
@grabboxhsize#1centeringboxtext@maintextvbox%
boxtext@b
newcommandboxtext@b[1][relax]
%
boxtext@ifrelax#1
@grabboxboxtext@bottomtextcolorboxtextborderhbox
@grabboxhsize#1centeringboxtext@bottomtextcolorboxtextbordervbox%
boxtext@out
newcommand*boxtext@siderule
%
vrule
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
width boxtextborder
relax
newcommand*boxtext@toprule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@toptext)/2-toptextpad
relax
height
dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad+.5boxtextborder
relax
depth
-dimexpr
htboxtext@maintext+.5htboxtext@toptext+.5dpboxtext@toptext
+toptextpad+maintextpad-.5boxtextborder
relax
relax
newcommand*boxtext@bottomrule
%
vrule
width
dimexpr
(boxtext@maxwd-wdboxtext@bottomtext)/2-bottomtextpad
relax
height
-dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad-.5boxtextborder
relax
depth
dimexpr
dpboxtext@maintext+.5htboxtext@bottomtext+.5dpboxtext@bottomtext
+maintextpad+bottomtextpad+.5boxtextborder
relax
relax
newcommand*boxtext@out
%
mbox
%
begingroup
ifdimwdboxtext@maintext>wdboxtext@toptext
ifdimwdboxtext@maintext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@maintext
else
boxtext@maxwdwdboxtext@bottomtext
fi
else
ifdimwdboxtext@toptext>wdboxtext@bottomtext
boxtext@maxwdwdboxtext@toptext
else
boxtext@maxwdwdboxtext@bottomtext
fi
fi
advanceboxtext@maxwd2maintextpad
colorboxtextborder%
boxtext@siderule
rlapmakebox[boxtext@maxwd][c]useboxboxtext@maintext%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
dimexpr
htboxtext@maintext+dpboxtext@toptext
+maintextpad+toptextpad
useboxboxtext@toptext%
%
%
rlap
%
makebox[boxtext@maxwd][c]
%
raisebox
%
-dimexpr
dpboxtext@maintext+htboxtext@bottomtext
+maintextpad+bottomtextpad
useboxboxtext@bottomtext%
%
%
rlapboxtext@toprule%
rlapboxtext@bottomrule%
hskipboxtext@maxwd
llapboxtext@toprule%
llapboxtext@bottomrule%
boxtext@siderule
endgroup
%
makeatother
begindocument
boxtext
Name xy
textcolorred2019
Name%
boxtext
textsfName xy
sffamilybfserieshugetextcolorred2019
textsfName
boxtextName xy[5cm]This is some text that is 5cm wideName
enddocument
answered Oct 1 at 14:51
SkillmonSkillmon
31.5k1 gold badge31 silver badges65 bronze badges
31.5k1 gold badge31 silver badges65 bronze badges
haha, ok that works as well ;-)
– simande
Oct 1 at 14:54
1
@simande and it's only 153 lines of code to create theboxtext
macro, so definitely the way to go!
– Skillmon
Oct 1 at 14:55
add a comment
|
haha, ok that works as well ;-)
– simande
Oct 1 at 14:54
1
@simande and it's only 153 lines of code to create theboxtext
macro, so definitely the way to go!
– Skillmon
Oct 1 at 14:55
haha, ok that works as well ;-)
– simande
Oct 1 at 14:54
haha, ok that works as well ;-)
– simande
Oct 1 at 14:54
1
1
@simande and it's only 153 lines of code to create the
boxtext
macro, so definitely the way to go!– Skillmon
Oct 1 at 14:55
@simande and it's only 153 lines of code to create the
boxtext
macro, so definitely the way to go!– Skillmon
Oct 1 at 14:55
add a comment
|
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f510533%2ftikz-box-frame-arround-text-with-interruption%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown