Draw a horizontal line from the left margin to the end of centered textHow to to set a padding around the page body, draw a frame/border around it, and then add some margin?Draw a vertical line on the margin across several pagesfrom A4 paper to A5 and keeping the number of characters per lineHow to add text in the margin, level with first line of paragragh?Print text on the left margin aligned with a given lineHow to (neatly/correctly) underline with a tikz rectangle?Increase left margin (without setting explicitly)How can I force a large matrix to be horizontally centered and allow it to exceed both margins?tufte-latex: excluding the sidenotes margin from certain pagesHow does using makebox allow arbitrary placement of things on a page?
How to justify a team increase when the team is doing good?
2000s Animated TV show where teenagers could physically go into a virtual world
Can Northern Ireland's border issue be solved by repartition?
extracting sublists
Does Sitecore have support for Sitecore products in containers?
Palatino font (newpxmath) misaligns text in fraction numerators
What is the meaning of word 'crack' in chapter 33 of A Game of Thrones?
Why did UK NHS pay for homeopathic treatments?
How can this Stack Exchange site have an animated favicon?
Which place in our solar system is the most fit for terraforming?
What exactly did this mechanic sabotage on the American Airlines 737, and how dangerous was it?
How do pilots align the HUD with their eyeballs?
Social leper versus social leopard
Co-Supervisor comes to office to help her students which distracts me
How can I repair this gas leak on my new range? Teflon tape isn't working
Is it impolite to ask for halal food when traveling to and in Thailand?
On the meaning of 'anyways' in "What Exactly Is a Quartz Crystal, Anyways?"
Can an integer optimization problem be convex?
Does wetting a beer glass change the foam characteristics?
Subverting the emotional woman and stoic man trope
Why weren't the Death Star plans transmitted electronically?
Designing a time thief proof safe
Find equation of the circle whose diameter is the common chord of two other circles?
Should the average user with no special access rights be worried about SMS-based 2FA being theoretically interceptable?
Draw a horizontal line from the left margin to the end of centered text
How to to set a padding around the page body, draw a frame/border around it, and then add some margin?Draw a vertical line on the margin across several pagesfrom A4 paper to A5 and keeping the number of characters per lineHow to add text in the margin, level with first line of paragragh?Print text on the left margin aligned with a given lineHow to (neatly/correctly) underline with a tikz rectangle?Increase left margin (without setting explicitly)How can I force a large matrix to be horizontally centered and allow it to exceed both margins?tufte-latex: excluding the sidenotes margin from certain pagesHow does using makebox allow arbitrary placement of things on a page?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to draw a horizontal line from the left margin of the current page to the end of a centered text. For example, if I write "Hello, world!" as centered text, I would like a line spanning up to the "!" symbol, like an underlining.
I would like to avoid using tikz
. Also, this should work for different texts (not just "Hello, world!"), so I would like to avoid having to hard-code the length or passing it as an argument.
How can I do this?
Thanks in advance for your answers!
margins underline
add a comment
|
I would like to draw a horizontal line from the left margin of the current page to the end of a centered text. For example, if I write "Hello, world!" as centered text, I would like a line spanning up to the "!" symbol, like an underlining.
I would like to avoid using tikz
. Also, this should work for different texts (not just "Hello, world!"), so I would like to avoid having to hard-code the length or passing it as an argument.
How can I do this?
Thanks in advance for your answers!
margins underline
hrulefill may be what you are looking for
– Schrödinger's cat
8 hours ago
a single-lined text?
– Bernard
8 hours ago
add a comment
|
I would like to draw a horizontal line from the left margin of the current page to the end of a centered text. For example, if I write "Hello, world!" as centered text, I would like a line spanning up to the "!" symbol, like an underlining.
I would like to avoid using tikz
. Also, this should work for different texts (not just "Hello, world!"), so I would like to avoid having to hard-code the length or passing it as an argument.
How can I do this?
Thanks in advance for your answers!
margins underline
I would like to draw a horizontal line from the left margin of the current page to the end of a centered text. For example, if I write "Hello, world!" as centered text, I would like a line spanning up to the "!" symbol, like an underlining.
I would like to avoid using tikz
. Also, this should work for different texts (not just "Hello, world!"), so I would like to avoid having to hard-code the length or passing it as an argument.
How can I do this?
Thanks in advance for your answers!
margins underline
margins underline
asked 8 hours ago
Diego SejasDiego Sejas
875 bronze badges
875 bronze badges
hrulefill may be what you are looking for
– Schrödinger's cat
8 hours ago
a single-lined text?
– Bernard
8 hours ago
add a comment
|
hrulefill may be what you are looking for
– Schrödinger's cat
8 hours ago
a single-lined text?
– Bernard
8 hours ago
hrulefill may be what you are looking for
– Schrödinger's cat
8 hours ago
hrulefill may be what you are looking for
– Schrödinger's cat
8 hours ago
a single-lined text?
– Bernard
8 hours ago
a single-lined text?
– Bernard
8 hours ago
add a comment
|
1 Answer
1
active
oldest
votes
The call to ulcenterline
causes a new paragraph. Is that OK? Or is to occur on the same line if there is already text on the left margin? The line usepackage[showframe,pass]geometry
is just there to show the frame about the text area of the page.
documentclassarticle
usepackage[showframe,pass]geometry
newcommandulcenterline[1]%
parnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
ulcenterlineHello World!
ulcenterlineThis is a bigger test!!
enddocument
If you need it to work without adding a par
, even if there is already text on the left-hand end of theline, then in my MWE, replace par
with tabto*0pt
, making sure to usepackagetabto
:
documentclassarticle
usepackagetabto
newcommandulcenterline[1]%
tabto*0ptnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
xxxulcenterlineHello World!
text already on lineulcenterlineThis is a bigger test!!
enddocument
1
Beautiful!!! It works perfectly. Thank you!
– Diego Sejas
8 hours ago
I can’t understand whyleavevmode
afternoindent
… ;-)
– GuM
7 hours ago
@GuM It used to be thatrlap
wouldn't automatically leave vertical mode, so thatrlap
wouldn't work as expected if issued after apar
. But with the DEC 18 change to the engine, which "fixed"smash
andphantom
, mayberlap
got fixed too. Thenoindent
was so that the initialrule
is set from the left margin, rather than the indent position.
– Steven B. Segletes
5 hours ago
@GuM Perhaps you are telling me thatnoindent
already leaves vertical mode?
– Steven B. Segletes
5 hours ago
Exactly:noindent
causes TeX to enter (unrestricted) horizontal mode. And no, also inLaTeX2e <2018-12-01>
, the meaning ofrlap
is stillmacro:#1->hb@xt@ z@ #1hss
(as it has always been).
– GuM
2 hours ago
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%2f509124%2fdraw-a-horizontal-line-from-the-left-margin-to-the-end-of-centered-text%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The call to ulcenterline
causes a new paragraph. Is that OK? Or is to occur on the same line if there is already text on the left margin? The line usepackage[showframe,pass]geometry
is just there to show the frame about the text area of the page.
documentclassarticle
usepackage[showframe,pass]geometry
newcommandulcenterline[1]%
parnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
ulcenterlineHello World!
ulcenterlineThis is a bigger test!!
enddocument
If you need it to work without adding a par
, even if there is already text on the left-hand end of theline, then in my MWE, replace par
with tabto*0pt
, making sure to usepackagetabto
:
documentclassarticle
usepackagetabto
newcommandulcenterline[1]%
tabto*0ptnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
xxxulcenterlineHello World!
text already on lineulcenterlineThis is a bigger test!!
enddocument
1
Beautiful!!! It works perfectly. Thank you!
– Diego Sejas
8 hours ago
I can’t understand whyleavevmode
afternoindent
… ;-)
– GuM
7 hours ago
@GuM It used to be thatrlap
wouldn't automatically leave vertical mode, so thatrlap
wouldn't work as expected if issued after apar
. But with the DEC 18 change to the engine, which "fixed"smash
andphantom
, mayberlap
got fixed too. Thenoindent
was so that the initialrule
is set from the left margin, rather than the indent position.
– Steven B. Segletes
5 hours ago
@GuM Perhaps you are telling me thatnoindent
already leaves vertical mode?
– Steven B. Segletes
5 hours ago
Exactly:noindent
causes TeX to enter (unrestricted) horizontal mode. And no, also inLaTeX2e <2018-12-01>
, the meaning ofrlap
is stillmacro:#1->hb@xt@ z@ #1hss
(as it has always been).
– GuM
2 hours ago
add a comment
|
The call to ulcenterline
causes a new paragraph. Is that OK? Or is to occur on the same line if there is already text on the left margin? The line usepackage[showframe,pass]geometry
is just there to show the frame about the text area of the page.
documentclassarticle
usepackage[showframe,pass]geometry
newcommandulcenterline[1]%
parnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
ulcenterlineHello World!
ulcenterlineThis is a bigger test!!
enddocument
If you need it to work without adding a par
, even if there is already text on the left-hand end of theline, then in my MWE, replace par
with tabto*0pt
, making sure to usepackagetabto
:
documentclassarticle
usepackagetabto
newcommandulcenterline[1]%
tabto*0ptnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
xxxulcenterlineHello World!
text already on lineulcenterlineThis is a bigger test!!
enddocument
1
Beautiful!!! It works perfectly. Thank you!
– Diego Sejas
8 hours ago
I can’t understand whyleavevmode
afternoindent
… ;-)
– GuM
7 hours ago
@GuM It used to be thatrlap
wouldn't automatically leave vertical mode, so thatrlap
wouldn't work as expected if issued after apar
. But with the DEC 18 change to the engine, which "fixed"smash
andphantom
, mayberlap
got fixed too. Thenoindent
was so that the initialrule
is set from the left margin, rather than the indent position.
– Steven B. Segletes
5 hours ago
@GuM Perhaps you are telling me thatnoindent
already leaves vertical mode?
– Steven B. Segletes
5 hours ago
Exactly:noindent
causes TeX to enter (unrestricted) horizontal mode. And no, also inLaTeX2e <2018-12-01>
, the meaning ofrlap
is stillmacro:#1->hb@xt@ z@ #1hss
(as it has always been).
– GuM
2 hours ago
add a comment
|
The call to ulcenterline
causes a new paragraph. Is that OK? Or is to occur on the same line if there is already text on the left margin? The line usepackage[showframe,pass]geometry
is just there to show the frame about the text area of the page.
documentclassarticle
usepackage[showframe,pass]geometry
newcommandulcenterline[1]%
parnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
ulcenterlineHello World!
ulcenterlineThis is a bigger test!!
enddocument
If you need it to work without adding a par
, even if there is already text on the left-hand end of theline, then in my MWE, replace par
with tabto*0pt
, making sure to usepackagetabto
:
documentclassarticle
usepackagetabto
newcommandulcenterline[1]%
tabto*0ptnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
xxxulcenterlineHello World!
text already on lineulcenterlineThis is a bigger test!!
enddocument
The call to ulcenterline
causes a new paragraph. Is that OK? Or is to occur on the same line if there is already text on the left margin? The line usepackage[showframe,pass]geometry
is just there to show the frame about the text area of the page.
documentclassarticle
usepackage[showframe,pass]geometry
newcommandulcenterline[1]%
parnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
ulcenterlineHello World!
ulcenterlineThis is a bigger test!!
enddocument
If you need it to work without adding a par
, even if there is already text on the left-hand end of theline, then in my MWE, replace par
with tabto*0pt
, making sure to usepackagetabto
:
documentclassarticle
usepackagetabto
newcommandulcenterline[1]%
tabto*0ptnoindentleavevmode
rlapunderlinevphantom#1rule.5linewidth0pt%
centerlineunderline#1%
begindocument
xxxulcenterlineHello World!
text already on lineulcenterlineThis is a bigger test!!
enddocument
edited 8 hours ago
answered 8 hours ago
Steven B. SegletesSteven B. Segletes
170k9 gold badges216 silver badges443 bronze badges
170k9 gold badges216 silver badges443 bronze badges
1
Beautiful!!! It works perfectly. Thank you!
– Diego Sejas
8 hours ago
I can’t understand whyleavevmode
afternoindent
… ;-)
– GuM
7 hours ago
@GuM It used to be thatrlap
wouldn't automatically leave vertical mode, so thatrlap
wouldn't work as expected if issued after apar
. But with the DEC 18 change to the engine, which "fixed"smash
andphantom
, mayberlap
got fixed too. Thenoindent
was so that the initialrule
is set from the left margin, rather than the indent position.
– Steven B. Segletes
5 hours ago
@GuM Perhaps you are telling me thatnoindent
already leaves vertical mode?
– Steven B. Segletes
5 hours ago
Exactly:noindent
causes TeX to enter (unrestricted) horizontal mode. And no, also inLaTeX2e <2018-12-01>
, the meaning ofrlap
is stillmacro:#1->hb@xt@ z@ #1hss
(as it has always been).
– GuM
2 hours ago
add a comment
|
1
Beautiful!!! It works perfectly. Thank you!
– Diego Sejas
8 hours ago
I can’t understand whyleavevmode
afternoindent
… ;-)
– GuM
7 hours ago
@GuM It used to be thatrlap
wouldn't automatically leave vertical mode, so thatrlap
wouldn't work as expected if issued after apar
. But with the DEC 18 change to the engine, which "fixed"smash
andphantom
, mayberlap
got fixed too. Thenoindent
was so that the initialrule
is set from the left margin, rather than the indent position.
– Steven B. Segletes
5 hours ago
@GuM Perhaps you are telling me thatnoindent
already leaves vertical mode?
– Steven B. Segletes
5 hours ago
Exactly:noindent
causes TeX to enter (unrestricted) horizontal mode. And no, also inLaTeX2e <2018-12-01>
, the meaning ofrlap
is stillmacro:#1->hb@xt@ z@ #1hss
(as it has always been).
– GuM
2 hours ago
1
1
Beautiful!!! It works perfectly. Thank you!
– Diego Sejas
8 hours ago
Beautiful!!! It works perfectly. Thank you!
– Diego Sejas
8 hours ago
I can’t understand why
leavevmode
after noindent
… ;-)– GuM
7 hours ago
I can’t understand why
leavevmode
after noindent
… ;-)– GuM
7 hours ago
@GuM It used to be that
rlap
wouldn't automatically leave vertical mode, so that rlap
wouldn't work as expected if issued after a par
. But with the DEC 18 change to the engine, which "fixed" smash
and phantom
, maybe rlap
got fixed too. The noindent
was so that the initial rule
is set from the left margin, rather than the indent position.– Steven B. Segletes
5 hours ago
@GuM It used to be that
rlap
wouldn't automatically leave vertical mode, so that rlap
wouldn't work as expected if issued after a par
. But with the DEC 18 change to the engine, which "fixed" smash
and phantom
, maybe rlap
got fixed too. The noindent
was so that the initial rule
is set from the left margin, rather than the indent position.– Steven B. Segletes
5 hours ago
@GuM Perhaps you are telling me that
noindent
already leaves vertical mode?– Steven B. Segletes
5 hours ago
@GuM Perhaps you are telling me that
noindent
already leaves vertical mode?– Steven B. Segletes
5 hours ago
Exactly:
noindent
causes TeX to enter (unrestricted) horizontal mode. And no, also in LaTeX2e <2018-12-01>
, the meaning of rlap
is still macro:#1->hb@xt@ z@ #1hss
(as it has always been).– GuM
2 hours ago
Exactly:
noindent
causes TeX to enter (unrestricted) horizontal mode. And no, also in LaTeX2e <2018-12-01>
, the meaning of rlap
is still macro:#1->hb@xt@ z@ #1hss
(as it has always been).– GuM
2 hours ago
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%2f509124%2fdraw-a-horizontal-line-from-the-left-margin-to-the-end-of-centered-text%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
hrulefill may be what you are looking for
– Schrödinger's cat
8 hours ago
a single-lined text?
– Bernard
8 hours ago