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;








3















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!










share|improve this question
























  • hrulefill may be what you are looking for

    – Schrödinger's cat
    8 hours ago











  • a single-lined text?

    – Bernard
    8 hours ago

















3















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!










share|improve this question
























  • hrulefill may be what you are looking for

    – Schrödinger's cat
    8 hours ago











  • a single-lined text?

    – Bernard
    8 hours ago













3












3








3








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!










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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










1 Answer
1






active

oldest

votes


















4
















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


enter image description here



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


enter image description here






share|improve this answer






















  • 1





    Beautiful!!! It works perfectly. Thank you!

    – Diego Sejas
    8 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 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













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
);



);














draft saved

draft discarded
















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









4
















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


enter image description here



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


enter image description here






share|improve this answer






















  • 1





    Beautiful!!! It works perfectly. Thank you!

    – Diego Sejas
    8 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 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















4
















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


enter image description here



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


enter image description here






share|improve this answer






















  • 1





    Beautiful!!! It works perfectly. Thank you!

    – Diego Sejas
    8 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 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













4














4










4









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


enter image description here



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


enter image description here






share|improve this answer















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


enter image description here



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


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








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 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 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












  • 1





    Beautiful!!! It works perfectly. Thank you!

    – Diego Sejas
    8 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 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







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


















draft saved

draft discarded















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її