How can I center arbitrary content between two horizontal lines?
Clash Royale CLAN TAG#URR8PPP
I want to implement a macro that takes exactly one parameter and will create a line above and below the content and ignores the text indentation.
This is meant to place some event information in protocols no matter what context I am in right now (e.g. within an enumerate or itemize).
It should interrupt the current block and always use the complete column width and then continue the block afterwards.
However, I am having problems with the vertical centering:
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
% Example Usage:
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
fouth point
enditemize
The text "Charlie enters the meeting" should begin at the left, like the "Some text before".
also the lines are placed pretty odd an the text within the lines isnt vertically centered.
Any clues/ suggestions?
formatting
add a comment |
I want to implement a macro that takes exactly one parameter and will create a line above and below the content and ignores the text indentation.
This is meant to place some event information in protocols no matter what context I am in right now (e.g. within an enumerate or itemize).
It should interrupt the current block and always use the complete column width and then continue the block afterwards.
However, I am having problems with the vertical centering:
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
% Example Usage:
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
fouth point
enditemize
The text "Charlie enters the meeting" should begin at the left, like the "Some text before".
also the lines are placed pretty odd an the text within the lines isnt vertically centered.
Any clues/ suggestions?
formatting
1
Why not useitem Second Point enditemize bartextCharlie enters the meeting beginitemize[resume*] item third point
and the ` enumitem` package?
– leandriis
Feb 3 at 21:45
add a comment |
I want to implement a macro that takes exactly one parameter and will create a line above and below the content and ignores the text indentation.
This is meant to place some event information in protocols no matter what context I am in right now (e.g. within an enumerate or itemize).
It should interrupt the current block and always use the complete column width and then continue the block afterwards.
However, I am having problems with the vertical centering:
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
% Example Usage:
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
fouth point
enditemize
The text "Charlie enters the meeting" should begin at the left, like the "Some text before".
also the lines are placed pretty odd an the text within the lines isnt vertically centered.
Any clues/ suggestions?
formatting
I want to implement a macro that takes exactly one parameter and will create a line above and below the content and ignores the text indentation.
This is meant to place some event information in protocols no matter what context I am in right now (e.g. within an enumerate or itemize).
It should interrupt the current block and always use the complete column width and then continue the block afterwards.
However, I am having problems with the vertical centering:
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
% Example Usage:
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
fouth point
enditemize
The text "Charlie enters the meeting" should begin at the left, like the "Some text before".
also the lines are placed pretty odd an the text within the lines isnt vertically centered.
Any clues/ suggestions?
formatting
formatting
edited Feb 3 at 21:39
Bernard
171k775202
171k775202
asked Feb 3 at 21:35
TobiTobi
1296
1296
1
Why not useitem Second Point enditemize bartextCharlie enters the meeting beginitemize[resume*] item third point
and the ` enumitem` package?
– leandriis
Feb 3 at 21:45
add a comment |
1
Why not useitem Second Point enditemize bartextCharlie enters the meeting beginitemize[resume*] item third point
and the ` enumitem` package?
– leandriis
Feb 3 at 21:45
1
1
Why not use
item Second Point enditemize bartextCharlie enters the meeting beginitemize[resume*] item third point
and the ` enumitem` package?– leandriis
Feb 3 at 21:45
Why not use
item Second Point enditemize bartextCharlie enters the meeting beginitemize[resume*] item third point
and the ` enumitem` package?– leandriis
Feb 3 at 21:45
add a comment |
3 Answers
3
active
oldest
votes
You can use a (non-floating) float:
documentclassarticle
usepackagearray,float
newcommandbartext[1]%
parmedskip
begingroup
intextsep=smallskipamount
extrarowheight =3pt %or perhaps a bit less ...
arrayrulewidth=.5pt
beginfigure[H]%
begintabular@ptextwidth@
hline
#1
\hline
endtabular%
endfigure%
parendgroup
begindocument
a
bartextCharlie enters the meeting
b
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
enddocument
Thanks, Ulrike. Very elegant solution. My documents are starting to look pretty now and start to be usable. Thanks.
– Tobi
Feb 3 at 23:08
add a comment |
Assuming that you do not want to use something like
enditemize
bartext...
beginitemize[resume*]
you could use the following code that is inspired by How can I check if the current code is inside a certain environment?
documentclassarticle
usepackageenumitem
usepackagelipsum
makeatletter
defitemizenameitemize
defenumeratenameenumerate
newcommandbartext[1]%
ifx@currenviritemizename
enditemize
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginitemize[resume*]
else
ifx@currenvirenumeratename
endenumerate
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginenumerate[resume*]
else
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
fi
fi
newcommand@myenvnamemyenv
makeatother
begindocument
lipsum[5]
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
lipsum[5]
beginenumerate
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
endenumerate
lipsum[5]
bartextCharlie enters the meeting
enddocument
Good but very complex solution. I went with the solution of Ulrike in the end
– Tobi
Feb 3 at 23:07
add a comment |
You can use the functionalities of enumitem
:
documentclassreport%memoir
usepackageenumitem
usepackagelipsum
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
begindocument
Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
beginitemize[after=vspace*-topsep]
item First Point
item Second Point
enditemize
bartextCharlie enters the meeting
beginitemize[resume*, before=vspace*-topsep]
item third point
item fourth point
enditemize
enddocument
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/3.0/"u003ecc by-sa 3.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%2f473244%2fhow-can-i-center-arbitrary-content-between-two-horizontal-lines%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use a (non-floating) float:
documentclassarticle
usepackagearray,float
newcommandbartext[1]%
parmedskip
begingroup
intextsep=smallskipamount
extrarowheight =3pt %or perhaps a bit less ...
arrayrulewidth=.5pt
beginfigure[H]%
begintabular@ptextwidth@
hline
#1
\hline
endtabular%
endfigure%
parendgroup
begindocument
a
bartextCharlie enters the meeting
b
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
enddocument
Thanks, Ulrike. Very elegant solution. My documents are starting to look pretty now and start to be usable. Thanks.
– Tobi
Feb 3 at 23:08
add a comment |
You can use a (non-floating) float:
documentclassarticle
usepackagearray,float
newcommandbartext[1]%
parmedskip
begingroup
intextsep=smallskipamount
extrarowheight =3pt %or perhaps a bit less ...
arrayrulewidth=.5pt
beginfigure[H]%
begintabular@ptextwidth@
hline
#1
\hline
endtabular%
endfigure%
parendgroup
begindocument
a
bartextCharlie enters the meeting
b
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
enddocument
Thanks, Ulrike. Very elegant solution. My documents are starting to look pretty now and start to be usable. Thanks.
– Tobi
Feb 3 at 23:08
add a comment |
You can use a (non-floating) float:
documentclassarticle
usepackagearray,float
newcommandbartext[1]%
parmedskip
begingroup
intextsep=smallskipamount
extrarowheight =3pt %or perhaps a bit less ...
arrayrulewidth=.5pt
beginfigure[H]%
begintabular@ptextwidth@
hline
#1
\hline
endtabular%
endfigure%
parendgroup
begindocument
a
bartextCharlie enters the meeting
b
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
enddocument
You can use a (non-floating) float:
documentclassarticle
usepackagearray,float
newcommandbartext[1]%
parmedskip
begingroup
intextsep=smallskipamount
extrarowheight =3pt %or perhaps a bit less ...
arrayrulewidth=.5pt
beginfigure[H]%
begintabular@ptextwidth@
hline
#1
\hline
endtabular%
endfigure%
parendgroup
begindocument
a
bartextCharlie enters the meeting
b
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
enddocument
answered Feb 3 at 22:26
Ulrike FischerUlrike Fischer
193k8302684
193k8302684
Thanks, Ulrike. Very elegant solution. My documents are starting to look pretty now and start to be usable. Thanks.
– Tobi
Feb 3 at 23:08
add a comment |
Thanks, Ulrike. Very elegant solution. My documents are starting to look pretty now and start to be usable. Thanks.
– Tobi
Feb 3 at 23:08
Thanks, Ulrike. Very elegant solution. My documents are starting to look pretty now and start to be usable. Thanks.
– Tobi
Feb 3 at 23:08
Thanks, Ulrike. Very elegant solution. My documents are starting to look pretty now and start to be usable. Thanks.
– Tobi
Feb 3 at 23:08
add a comment |
Assuming that you do not want to use something like
enditemize
bartext...
beginitemize[resume*]
you could use the following code that is inspired by How can I check if the current code is inside a certain environment?
documentclassarticle
usepackageenumitem
usepackagelipsum
makeatletter
defitemizenameitemize
defenumeratenameenumerate
newcommandbartext[1]%
ifx@currenviritemizename
enditemize
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginitemize[resume*]
else
ifx@currenvirenumeratename
endenumerate
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginenumerate[resume*]
else
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
fi
fi
newcommand@myenvnamemyenv
makeatother
begindocument
lipsum[5]
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
lipsum[5]
beginenumerate
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
endenumerate
lipsum[5]
bartextCharlie enters the meeting
enddocument
Good but very complex solution. I went with the solution of Ulrike in the end
– Tobi
Feb 3 at 23:07
add a comment |
Assuming that you do not want to use something like
enditemize
bartext...
beginitemize[resume*]
you could use the following code that is inspired by How can I check if the current code is inside a certain environment?
documentclassarticle
usepackageenumitem
usepackagelipsum
makeatletter
defitemizenameitemize
defenumeratenameenumerate
newcommandbartext[1]%
ifx@currenviritemizename
enditemize
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginitemize[resume*]
else
ifx@currenvirenumeratename
endenumerate
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginenumerate[resume*]
else
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
fi
fi
newcommand@myenvnamemyenv
makeatother
begindocument
lipsum[5]
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
lipsum[5]
beginenumerate
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
endenumerate
lipsum[5]
bartextCharlie enters the meeting
enddocument
Good but very complex solution. I went with the solution of Ulrike in the end
– Tobi
Feb 3 at 23:07
add a comment |
Assuming that you do not want to use something like
enditemize
bartext...
beginitemize[resume*]
you could use the following code that is inspired by How can I check if the current code is inside a certain environment?
documentclassarticle
usepackageenumitem
usepackagelipsum
makeatletter
defitemizenameitemize
defenumeratenameenumerate
newcommandbartext[1]%
ifx@currenviritemizename
enditemize
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginitemize[resume*]
else
ifx@currenvirenumeratename
endenumerate
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginenumerate[resume*]
else
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
fi
fi
newcommand@myenvnamemyenv
makeatother
begindocument
lipsum[5]
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
lipsum[5]
beginenumerate
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
endenumerate
lipsum[5]
bartextCharlie enters the meeting
enddocument
Assuming that you do not want to use something like
enditemize
bartext...
beginitemize[resume*]
you could use the following code that is inspired by How can I check if the current code is inside a certain environment?
documentclassarticle
usepackageenumitem
usepackagelipsum
makeatletter
defitemizenameitemize
defenumeratenameenumerate
newcommandbartext[1]%
ifx@currenviritemizename
enditemize
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginitemize[resume*]
else
ifx@currenvirenumeratename
endenumerate
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
beginenumerate[resume*]
else
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt
fi
fi
newcommand@myenvnamemyenv
makeatother
begindocument
lipsum[5]
beginitemize
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
enditemize
lipsum[5]
beginenumerate
item First Point
item Second Point
bartextCharlie enters the meeting
item third point
item fouth point
endenumerate
lipsum[5]
bartextCharlie enters the meeting
enddocument
answered Feb 3 at 22:01
leandriisleandriis
9,1771530
9,1771530
Good but very complex solution. I went with the solution of Ulrike in the end
– Tobi
Feb 3 at 23:07
add a comment |
Good but very complex solution. I went with the solution of Ulrike in the end
– Tobi
Feb 3 at 23:07
Good but very complex solution. I went with the solution of Ulrike in the end
– Tobi
Feb 3 at 23:07
Good but very complex solution. I went with the solution of Ulrike in the end
– Tobi
Feb 3 at 23:07
add a comment |
You can use the functionalities of enumitem
:
documentclassreport%memoir
usepackageenumitem
usepackagelipsum
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
begindocument
Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
beginitemize[after=vspace*-topsep]
item First Point
item Second Point
enditemize
bartextCharlie enters the meeting
beginitemize[resume*, before=vspace*-topsep]
item third point
item fourth point
enditemize
enddocument
add a comment |
You can use the functionalities of enumitem
:
documentclassreport%memoir
usepackageenumitem
usepackagelipsum
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
begindocument
Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
beginitemize[after=vspace*-topsep]
item First Point
item Second Point
enditemize
bartextCharlie enters the meeting
beginitemize[resume*, before=vspace*-topsep]
item third point
item fourth point
enditemize
enddocument
add a comment |
You can use the functionalities of enumitem
:
documentclassreport%memoir
usepackageenumitem
usepackagelipsum
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
begindocument
Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
beginitemize[after=vspace*-topsep]
item First Point
item Second Point
enditemize
bartextCharlie enters the meeting
beginitemize[resume*, before=vspace*-topsep]
item third point
item fourth point
enditemize
enddocument
You can use the functionalities of enumitem
:
documentclassreport%memoir
usepackageenumitem
usepackagelipsum
newcommandbartext[1]
kern4pt % space above the rules
hrule height 0.5pt
vspace0.1cm
noindent #1
vspace0.1cm
hrule height 0.5pt
kern4pt % space below the rules
begindocument
Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
beginitemize[after=vspace*-topsep]
item First Point
item Second Point
enditemize
bartextCharlie enters the meeting
beginitemize[resume*, before=vspace*-topsep]
item third point
item fourth point
enditemize
enddocument
answered Feb 3 at 21:56
BernardBernard
171k775202
171k775202
add a comment |
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%2f473244%2fhow-can-i-center-arbitrary-content-between-two-horizontal-lines%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
1
Why not use
item Second Point enditemize bartextCharlie enters the meeting beginitemize[resume*] item third point
and the ` enumitem` package?– leandriis
Feb 3 at 21:45