insert text in rule











up vote
2
down vote

favorite












I have difficulty writing a compact command that allows me to insert a text between two lines.
I read some links such as this and this, but each one treats the left and right line separately



documentclass{article}
usepackage{amsmath} %<<===
usepackage[normalem]{ulem}
usepackage{xcolor}

newcommandgsout{bgroupmarkoverwith{textcolor{gray}{rule[0.5ex]{2pt}{2.5pt}}}ULon}

newcommand*{sxrule}[1][3em]{textcolor{gray}{rule[0.5ex]{#1}{2.5pt}};}


begin{document}

sxrule Osservazioni gsout{hfill}

end{document}


enter image description here



Have any suggestions? thanks










share|improve this question
























  • Should it be on a separate line?
    – Bernard
    Nov 28 at 20:36










  • @Bernard a newcommand 'ruletext {...}rule'
    – Antonio
    Nov 28 at 20:42










  • I don't see exactly what you're trying to obtain. Could you explain more, or post a hand-made sketch?
    – Bernard
    Nov 28 at 20:47








  • 1




    I can't compile this code – there's an error messageright after sxrule.
    – Bernard
    Nov 29 at 0:10






  • 1




    The compilation error in the MWE is caused by ; as this is math-mode spacing so it needs to typed as $;$.
    – Andrew
    Nov 29 at 9:15















up vote
2
down vote

favorite












I have difficulty writing a compact command that allows me to insert a text between two lines.
I read some links such as this and this, but each one treats the left and right line separately



documentclass{article}
usepackage{amsmath} %<<===
usepackage[normalem]{ulem}
usepackage{xcolor}

newcommandgsout{bgroupmarkoverwith{textcolor{gray}{rule[0.5ex]{2pt}{2.5pt}}}ULon}

newcommand*{sxrule}[1][3em]{textcolor{gray}{rule[0.5ex]{#1}{2.5pt}};}


begin{document}

sxrule Osservazioni gsout{hfill}

end{document}


enter image description here



Have any suggestions? thanks










share|improve this question
























  • Should it be on a separate line?
    – Bernard
    Nov 28 at 20:36










  • @Bernard a newcommand 'ruletext {...}rule'
    – Antonio
    Nov 28 at 20:42










  • I don't see exactly what you're trying to obtain. Could you explain more, or post a hand-made sketch?
    – Bernard
    Nov 28 at 20:47








  • 1




    I can't compile this code – there's an error messageright after sxrule.
    – Bernard
    Nov 29 at 0:10






  • 1




    The compilation error in the MWE is caused by ; as this is math-mode spacing so it needs to typed as $;$.
    – Andrew
    Nov 29 at 9:15













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have difficulty writing a compact command that allows me to insert a text between two lines.
I read some links such as this and this, but each one treats the left and right line separately



documentclass{article}
usepackage{amsmath} %<<===
usepackage[normalem]{ulem}
usepackage{xcolor}

newcommandgsout{bgroupmarkoverwith{textcolor{gray}{rule[0.5ex]{2pt}{2.5pt}}}ULon}

newcommand*{sxrule}[1][3em]{textcolor{gray}{rule[0.5ex]{#1}{2.5pt}};}


begin{document}

sxrule Osservazioni gsout{hfill}

end{document}


enter image description here



Have any suggestions? thanks










share|improve this question















I have difficulty writing a compact command that allows me to insert a text between two lines.
I read some links such as this and this, but each one treats the left and right line separately



documentclass{article}
usepackage{amsmath} %<<===
usepackage[normalem]{ulem}
usepackage{xcolor}

newcommandgsout{bgroupmarkoverwith{textcolor{gray}{rule[0.5ex]{2pt}{2.5pt}}}ULon}

newcommand*{sxrule}[1][3em]{textcolor{gray}{rule[0.5ex]{#1}{2.5pt}};}


begin{document}

sxrule Osservazioni gsout{hfill}

end{document}


enter image description here



Have any suggestions? thanks







rules text ulem






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 29 at 5:48

























asked Nov 28 at 20:30









Antonio

14811




14811












  • Should it be on a separate line?
    – Bernard
    Nov 28 at 20:36










  • @Bernard a newcommand 'ruletext {...}rule'
    – Antonio
    Nov 28 at 20:42










  • I don't see exactly what you're trying to obtain. Could you explain more, or post a hand-made sketch?
    – Bernard
    Nov 28 at 20:47








  • 1




    I can't compile this code – there's an error messageright after sxrule.
    – Bernard
    Nov 29 at 0:10






  • 1




    The compilation error in the MWE is caused by ; as this is math-mode spacing so it needs to typed as $;$.
    – Andrew
    Nov 29 at 9:15


















  • Should it be on a separate line?
    – Bernard
    Nov 28 at 20:36










  • @Bernard a newcommand 'ruletext {...}rule'
    – Antonio
    Nov 28 at 20:42










  • I don't see exactly what you're trying to obtain. Could you explain more, or post a hand-made sketch?
    – Bernard
    Nov 28 at 20:47








  • 1




    I can't compile this code – there's an error messageright after sxrule.
    – Bernard
    Nov 29 at 0:10






  • 1




    The compilation error in the MWE is caused by ; as this is math-mode spacing so it needs to typed as $;$.
    – Andrew
    Nov 29 at 9:15
















Should it be on a separate line?
– Bernard
Nov 28 at 20:36




Should it be on a separate line?
– Bernard
Nov 28 at 20:36












@Bernard a newcommand 'ruletext {...}rule'
– Antonio
Nov 28 at 20:42




@Bernard a newcommand 'ruletext {...}rule'
– Antonio
Nov 28 at 20:42












I don't see exactly what you're trying to obtain. Could you explain more, or post a hand-made sketch?
– Bernard
Nov 28 at 20:47






I don't see exactly what you're trying to obtain. Could you explain more, or post a hand-made sketch?
– Bernard
Nov 28 at 20:47






1




1




I can't compile this code – there's an error messageright after sxrule.
– Bernard
Nov 29 at 0:10




I can't compile this code – there's an error messageright after sxrule.
– Bernard
Nov 29 at 0:10




1




1




The compilation error in the MWE is caused by ; as this is math-mode spacing so it needs to typed as $;$.
– Andrew
Nov 29 at 9:15




The compilation error in the MWE is caused by ; as this is math-mode spacing so it needs to typed as $;$.
– Andrew
Nov 29 at 9:15










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










Perhaps something like this:



enter image description here



Here's the code:



documentclass{article}
usepackage{xcolor}
usepackage{lipsum}

newlengthsxrulelength
newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},#2,%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}

begin{document}

lipsum

sxrule{Osservazioni}

lipsum

end{document}


The sxrule macro has an optional argument that controls the length of the "left hand" line. As in the OP, this defaults to 3em.



Judging from the comments, perhaps the definition



newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},textbf{#2},%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}


is better as now sxrule{Osservazioni} puts "Osservazioni" in bold:



enter image description here






share|improve this answer























  • interesting solution, I was trying with this but I was wrong. The color of the text and lines must be independent. The line must be gray (or another color), while the text must be black
    – Antonio
    Nov 29 at 6:06










  • I found another problem. if I use this command, all the text under the command stays gray : sxruledx{textbf{Osservazioni}}\ lipsum[3]
    – Antonio
    Nov 29 at 6:26






  • 1




    @Antonio See my edit to the colour of the text in the midle of the lines (sorry, I thought that you wanted it gray as well:). As above, the colour after the sxrule should be black, not, gray. Finally, use a blank line instead of \ after the sxrule...alternatively make this part of the macro definition.
    – Andrew
    Nov 29 at 9:19












  • my alternative solution : newlengthsxrulelength newcommandsxruledx[2][2.5em]{color{black}vspace{0.25cm}% settowidthsxrulelength{$,$#2$,$}% noindent% textcolor{gray}{rule[0.5ex]{#1}{1.5pt}textcolor{blue}{$,$#2$,$}% rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{1.5pt}{}vspace{0.25cm}}% }
    – Antonio
    Nov 29 at 17:52




















up vote
2
down vote














mwe




documentclass{article}
usepackage[normalem]{ulem}
usepackage{xcolor,lipsum}
newcommandfilrule{{color{gray}{leaders
hrule height .7ex depth -.4ex hfill }hskip .0em}}
defruledworld#1{bigskipnoindentfilrulequad%
#1quadfilrulebigskippar}
begin{document}
ruledworld{Osservazioni}
lipsum[2]
ruledworld{Grandi conclusioni}
lipsum[3]
end{document}


If you do not want the word centered but start at a fixed point, change the first filrule in the definition of ruledworld by a normal rule. Or You can left a single filrule on the left, but a few on the right (e.g., filrulefilrulefilrule) to have the word centered with respect some point (at the 25% of the line, in that example).






share|improve this answer























  • if I enter rule, I get this error : Undefined control sequence. ruledworld{Osservazioni} and Command rule already defined. ...ht .7ex depth -.4ex hfill }hskip .0em}}
    – Antonio
    Nov 29 at 5:59








  • 1




    @Antonio Sorry, I mean "rule" with their mandatory and optional arguments, just as you used in your minimal working example (e.g . rule[0.5ex]{2pt}{2.5pt}) but obviously changing these arguments as you need. For example: rule[.4ex]{1em}{.3ex}
    – Fran
    Nov 29 at 9:33








  • 1




    @Antonio And obviously you need to take care also of add a gray color for this rule, as the color was defined only inside the filrule definition.
    – Fran
    Nov 29 at 9:43











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',
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462245%2finsert-text-in-rule%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








up vote
2
down vote



accepted










Perhaps something like this:



enter image description here



Here's the code:



documentclass{article}
usepackage{xcolor}
usepackage{lipsum}

newlengthsxrulelength
newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},#2,%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}

begin{document}

lipsum

sxrule{Osservazioni}

lipsum

end{document}


The sxrule macro has an optional argument that controls the length of the "left hand" line. As in the OP, this defaults to 3em.



Judging from the comments, perhaps the definition



newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},textbf{#2},%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}


is better as now sxrule{Osservazioni} puts "Osservazioni" in bold:



enter image description here






share|improve this answer























  • interesting solution, I was trying with this but I was wrong. The color of the text and lines must be independent. The line must be gray (or another color), while the text must be black
    – Antonio
    Nov 29 at 6:06










  • I found another problem. if I use this command, all the text under the command stays gray : sxruledx{textbf{Osservazioni}}\ lipsum[3]
    – Antonio
    Nov 29 at 6:26






  • 1




    @Antonio See my edit to the colour of the text in the midle of the lines (sorry, I thought that you wanted it gray as well:). As above, the colour after the sxrule should be black, not, gray. Finally, use a blank line instead of \ after the sxrule...alternatively make this part of the macro definition.
    – Andrew
    Nov 29 at 9:19












  • my alternative solution : newlengthsxrulelength newcommandsxruledx[2][2.5em]{color{black}vspace{0.25cm}% settowidthsxrulelength{$,$#2$,$}% noindent% textcolor{gray}{rule[0.5ex]{#1}{1.5pt}textcolor{blue}{$,$#2$,$}% rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{1.5pt}{}vspace{0.25cm}}% }
    – Antonio
    Nov 29 at 17:52

















up vote
2
down vote



accepted










Perhaps something like this:



enter image description here



Here's the code:



documentclass{article}
usepackage{xcolor}
usepackage{lipsum}

newlengthsxrulelength
newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},#2,%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}

begin{document}

lipsum

sxrule{Osservazioni}

lipsum

end{document}


The sxrule macro has an optional argument that controls the length of the "left hand" line. As in the OP, this defaults to 3em.



Judging from the comments, perhaps the definition



newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},textbf{#2},%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}


is better as now sxrule{Osservazioni} puts "Osservazioni" in bold:



enter image description here






share|improve this answer























  • interesting solution, I was trying with this but I was wrong. The color of the text and lines must be independent. The line must be gray (or another color), while the text must be black
    – Antonio
    Nov 29 at 6:06










  • I found another problem. if I use this command, all the text under the command stays gray : sxruledx{textbf{Osservazioni}}\ lipsum[3]
    – Antonio
    Nov 29 at 6:26






  • 1




    @Antonio See my edit to the colour of the text in the midle of the lines (sorry, I thought that you wanted it gray as well:). As above, the colour after the sxrule should be black, not, gray. Finally, use a blank line instead of \ after the sxrule...alternatively make this part of the macro definition.
    – Andrew
    Nov 29 at 9:19












  • my alternative solution : newlengthsxrulelength newcommandsxruledx[2][2.5em]{color{black}vspace{0.25cm}% settowidthsxrulelength{$,$#2$,$}% noindent% textcolor{gray}{rule[0.5ex]{#1}{1.5pt}textcolor{blue}{$,$#2$,$}% rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{1.5pt}{}vspace{0.25cm}}% }
    – Antonio
    Nov 29 at 17:52















up vote
2
down vote



accepted







up vote
2
down vote



accepted






Perhaps something like this:



enter image description here



Here's the code:



documentclass{article}
usepackage{xcolor}
usepackage{lipsum}

newlengthsxrulelength
newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},#2,%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}

begin{document}

lipsum

sxrule{Osservazioni}

lipsum

end{document}


The sxrule macro has an optional argument that controls the length of the "left hand" line. As in the OP, this defaults to 3em.



Judging from the comments, perhaps the definition



newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},textbf{#2},%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}


is better as now sxrule{Osservazioni} puts "Osservazioni" in bold:



enter image description here






share|improve this answer














Perhaps something like this:



enter image description here



Here's the code:



documentclass{article}
usepackage{xcolor}
usepackage{lipsum}

newlengthsxrulelength
newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},#2,%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}

begin{document}

lipsum

sxrule{Osservazioni}

lipsum

end{document}


The sxrule macro has an optional argument that controls the length of the "left hand" line. As in the OP, this defaults to 3em.



Judging from the comments, perhaps the definition



newcommandsxrule[2][3em]{%
settowidthsxrulelength{,#2,}%
noindent%
textcolor{gray}{rule[0.5ex]{#1}{2.5pt}},textbf{#2},%
textcolor{gray}{rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{2.5pt}}%
}


is better as now sxrule{Osservazioni} puts "Osservazioni" in bold:



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 29 at 9:17

























answered Nov 29 at 0:53









Andrew

30.1k34380




30.1k34380












  • interesting solution, I was trying with this but I was wrong. The color of the text and lines must be independent. The line must be gray (or another color), while the text must be black
    – Antonio
    Nov 29 at 6:06










  • I found another problem. if I use this command, all the text under the command stays gray : sxruledx{textbf{Osservazioni}}\ lipsum[3]
    – Antonio
    Nov 29 at 6:26






  • 1




    @Antonio See my edit to the colour of the text in the midle of the lines (sorry, I thought that you wanted it gray as well:). As above, the colour after the sxrule should be black, not, gray. Finally, use a blank line instead of \ after the sxrule...alternatively make this part of the macro definition.
    – Andrew
    Nov 29 at 9:19












  • my alternative solution : newlengthsxrulelength newcommandsxruledx[2][2.5em]{color{black}vspace{0.25cm}% settowidthsxrulelength{$,$#2$,$}% noindent% textcolor{gray}{rule[0.5ex]{#1}{1.5pt}textcolor{blue}{$,$#2$,$}% rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{1.5pt}{}vspace{0.25cm}}% }
    – Antonio
    Nov 29 at 17:52




















  • interesting solution, I was trying with this but I was wrong. The color of the text and lines must be independent. The line must be gray (or another color), while the text must be black
    – Antonio
    Nov 29 at 6:06










  • I found another problem. if I use this command, all the text under the command stays gray : sxruledx{textbf{Osservazioni}}\ lipsum[3]
    – Antonio
    Nov 29 at 6:26






  • 1




    @Antonio See my edit to the colour of the text in the midle of the lines (sorry, I thought that you wanted it gray as well:). As above, the colour after the sxrule should be black, not, gray. Finally, use a blank line instead of \ after the sxrule...alternatively make this part of the macro definition.
    – Andrew
    Nov 29 at 9:19












  • my alternative solution : newlengthsxrulelength newcommandsxruledx[2][2.5em]{color{black}vspace{0.25cm}% settowidthsxrulelength{$,$#2$,$}% noindent% textcolor{gray}{rule[0.5ex]{#1}{1.5pt}textcolor{blue}{$,$#2$,$}% rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{1.5pt}{}vspace{0.25cm}}% }
    – Antonio
    Nov 29 at 17:52


















interesting solution, I was trying with this but I was wrong. The color of the text and lines must be independent. The line must be gray (or another color), while the text must be black
– Antonio
Nov 29 at 6:06




interesting solution, I was trying with this but I was wrong. The color of the text and lines must be independent. The line must be gray (or another color), while the text must be black
– Antonio
Nov 29 at 6:06












I found another problem. if I use this command, all the text under the command stays gray : sxruledx{textbf{Osservazioni}}\ lipsum[3]
– Antonio
Nov 29 at 6:26




I found another problem. if I use this command, all the text under the command stays gray : sxruledx{textbf{Osservazioni}}\ lipsum[3]
– Antonio
Nov 29 at 6:26




1




1




@Antonio See my edit to the colour of the text in the midle of the lines (sorry, I thought that you wanted it gray as well:). As above, the colour after the sxrule should be black, not, gray. Finally, use a blank line instead of \ after the sxrule...alternatively make this part of the macro definition.
– Andrew
Nov 29 at 9:19






@Antonio See my edit to the colour of the text in the midle of the lines (sorry, I thought that you wanted it gray as well:). As above, the colour after the sxrule should be black, not, gray. Finally, use a blank line instead of \ after the sxrule...alternatively make this part of the macro definition.
– Andrew
Nov 29 at 9:19














my alternative solution : newlengthsxrulelength newcommandsxruledx[2][2.5em]{color{black}vspace{0.25cm}% settowidthsxrulelength{$,$#2$,$}% noindent% textcolor{gray}{rule[0.5ex]{#1}{1.5pt}textcolor{blue}{$,$#2$,$}% rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{1.5pt}{}vspace{0.25cm}}% }
– Antonio
Nov 29 at 17:52






my alternative solution : newlengthsxrulelength newcommandsxruledx[2][2.5em]{color{black}vspace{0.25cm}% settowidthsxrulelength{$,$#2$,$}% noindent% textcolor{gray}{rule[0.5ex]{#1}{1.5pt}textcolor{blue}{$,$#2$,$}% rule[0.5ex]{dimexprlinewidth-sxrulelength-#1relax}{1.5pt}{}vspace{0.25cm}}% }
– Antonio
Nov 29 at 17:52












up vote
2
down vote














mwe




documentclass{article}
usepackage[normalem]{ulem}
usepackage{xcolor,lipsum}
newcommandfilrule{{color{gray}{leaders
hrule height .7ex depth -.4ex hfill }hskip .0em}}
defruledworld#1{bigskipnoindentfilrulequad%
#1quadfilrulebigskippar}
begin{document}
ruledworld{Osservazioni}
lipsum[2]
ruledworld{Grandi conclusioni}
lipsum[3]
end{document}


If you do not want the word centered but start at a fixed point, change the first filrule in the definition of ruledworld by a normal rule. Or You can left a single filrule on the left, but a few on the right (e.g., filrulefilrulefilrule) to have the word centered with respect some point (at the 25% of the line, in that example).






share|improve this answer























  • if I enter rule, I get this error : Undefined control sequence. ruledworld{Osservazioni} and Command rule already defined. ...ht .7ex depth -.4ex hfill }hskip .0em}}
    – Antonio
    Nov 29 at 5:59








  • 1




    @Antonio Sorry, I mean "rule" with their mandatory and optional arguments, just as you used in your minimal working example (e.g . rule[0.5ex]{2pt}{2.5pt}) but obviously changing these arguments as you need. For example: rule[.4ex]{1em}{.3ex}
    – Fran
    Nov 29 at 9:33








  • 1




    @Antonio And obviously you need to take care also of add a gray color for this rule, as the color was defined only inside the filrule definition.
    – Fran
    Nov 29 at 9:43















up vote
2
down vote














mwe




documentclass{article}
usepackage[normalem]{ulem}
usepackage{xcolor,lipsum}
newcommandfilrule{{color{gray}{leaders
hrule height .7ex depth -.4ex hfill }hskip .0em}}
defruledworld#1{bigskipnoindentfilrulequad%
#1quadfilrulebigskippar}
begin{document}
ruledworld{Osservazioni}
lipsum[2]
ruledworld{Grandi conclusioni}
lipsum[3]
end{document}


If you do not want the word centered but start at a fixed point, change the first filrule in the definition of ruledworld by a normal rule. Or You can left a single filrule on the left, but a few on the right (e.g., filrulefilrulefilrule) to have the word centered with respect some point (at the 25% of the line, in that example).






share|improve this answer























  • if I enter rule, I get this error : Undefined control sequence. ruledworld{Osservazioni} and Command rule already defined. ...ht .7ex depth -.4ex hfill }hskip .0em}}
    – Antonio
    Nov 29 at 5:59








  • 1




    @Antonio Sorry, I mean "rule" with their mandatory and optional arguments, just as you used in your minimal working example (e.g . rule[0.5ex]{2pt}{2.5pt}) but obviously changing these arguments as you need. For example: rule[.4ex]{1em}{.3ex}
    – Fran
    Nov 29 at 9:33








  • 1




    @Antonio And obviously you need to take care also of add a gray color for this rule, as the color was defined only inside the filrule definition.
    – Fran
    Nov 29 at 9:43













up vote
2
down vote










up vote
2
down vote










mwe




documentclass{article}
usepackage[normalem]{ulem}
usepackage{xcolor,lipsum}
newcommandfilrule{{color{gray}{leaders
hrule height .7ex depth -.4ex hfill }hskip .0em}}
defruledworld#1{bigskipnoindentfilrulequad%
#1quadfilrulebigskippar}
begin{document}
ruledworld{Osservazioni}
lipsum[2]
ruledworld{Grandi conclusioni}
lipsum[3]
end{document}


If you do not want the word centered but start at a fixed point, change the first filrule in the definition of ruledworld by a normal rule. Or You can left a single filrule on the left, but a few on the right (e.g., filrulefilrulefilrule) to have the word centered with respect some point (at the 25% of the line, in that example).






share|improve this answer















mwe




documentclass{article}
usepackage[normalem]{ulem}
usepackage{xcolor,lipsum}
newcommandfilrule{{color{gray}{leaders
hrule height .7ex depth -.4ex hfill }hskip .0em}}
defruledworld#1{bigskipnoindentfilrulequad%
#1quadfilrulebigskippar}
begin{document}
ruledworld{Osservazioni}
lipsum[2]
ruledworld{Grandi conclusioni}
lipsum[3]
end{document}


If you do not want the word centered but start at a fixed point, change the first filrule in the definition of ruledworld by a normal rule. Or You can left a single filrule on the left, but a few on the right (e.g., filrulefilrulefilrule) to have the word centered with respect some point (at the 25% of the line, in that example).







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 29 at 1:16

























answered Nov 29 at 0:46









Fran

50.2k6111174




50.2k6111174












  • if I enter rule, I get this error : Undefined control sequence. ruledworld{Osservazioni} and Command rule already defined. ...ht .7ex depth -.4ex hfill }hskip .0em}}
    – Antonio
    Nov 29 at 5:59








  • 1




    @Antonio Sorry, I mean "rule" with their mandatory and optional arguments, just as you used in your minimal working example (e.g . rule[0.5ex]{2pt}{2.5pt}) but obviously changing these arguments as you need. For example: rule[.4ex]{1em}{.3ex}
    – Fran
    Nov 29 at 9:33








  • 1




    @Antonio And obviously you need to take care also of add a gray color for this rule, as the color was defined only inside the filrule definition.
    – Fran
    Nov 29 at 9:43


















  • if I enter rule, I get this error : Undefined control sequence. ruledworld{Osservazioni} and Command rule already defined. ...ht .7ex depth -.4ex hfill }hskip .0em}}
    – Antonio
    Nov 29 at 5:59








  • 1




    @Antonio Sorry, I mean "rule" with their mandatory and optional arguments, just as you used in your minimal working example (e.g . rule[0.5ex]{2pt}{2.5pt}) but obviously changing these arguments as you need. For example: rule[.4ex]{1em}{.3ex}
    – Fran
    Nov 29 at 9:33








  • 1




    @Antonio And obviously you need to take care also of add a gray color for this rule, as the color was defined only inside the filrule definition.
    – Fran
    Nov 29 at 9:43
















if I enter rule, I get this error : Undefined control sequence. ruledworld{Osservazioni} and Command rule already defined. ...ht .7ex depth -.4ex hfill }hskip .0em}}
– Antonio
Nov 29 at 5:59






if I enter rule, I get this error : Undefined control sequence. ruledworld{Osservazioni} and Command rule already defined. ...ht .7ex depth -.4ex hfill }hskip .0em}}
– Antonio
Nov 29 at 5:59






1




1




@Antonio Sorry, I mean "rule" with their mandatory and optional arguments, just as you used in your minimal working example (e.g . rule[0.5ex]{2pt}{2.5pt}) but obviously changing these arguments as you need. For example: rule[.4ex]{1em}{.3ex}
– Fran
Nov 29 at 9:33






@Antonio Sorry, I mean "rule" with their mandatory and optional arguments, just as you used in your minimal working example (e.g . rule[0.5ex]{2pt}{2.5pt}) but obviously changing these arguments as you need. For example: rule[.4ex]{1em}{.3ex}
– Fran
Nov 29 at 9:33






1




1




@Antonio And obviously you need to take care also of add a gray color for this rule, as the color was defined only inside the filrule definition.
– Fran
Nov 29 at 9:43




@Antonio And obviously you need to take care also of add a gray color for this rule, as the color was defined only inside the filrule definition.
– Fran
Nov 29 at 9:43


















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f462245%2finsert-text-in-rule%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

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?