I can't seem to shift an \hrule to the right so that it starts some distance after the left margin.

  \hrule width5pt


wanted output (red segment represents horizontal space preceding hrule)


2 Answers 2


You can do it as follows; note that varwidth does several things that make this unusable in that context.

\moveright0.2cm\vbox{\hrule width5pt}\nointerlineskip
\noindent hello


In order to trick varwidth, you can do


\vbox{\moveright0.2cm\vbox{\hrule width5pt}}\nointerlineskip


enter image description here


It's possible, but you have to use \vrule instead, and you'll need more boxes and an explicit dimen, at least as far as I can see.

Here, I'm assuming that you want your rule horizontally shifted by the width of the letter "h"; hence, I'm explicitly defining a \newbox called \hhbox, which is an \hbox containing only the letter "h". I'm then defining a dimen, \hwid, which is the width of \hhbox.

We then put together a \vbox which contains two \hboxes, one with the rule shifted to the right by the width of \hwid, and one with the word "hello". I've used explicit heights for the \vboxes to keep everything close together; making it more flexible is left as an exercise for the reader.

    \vbox to10pt{%
        \vbox to0pt{\hbox{\hskip\hwid\vrule height0.5pt width5pt depth0pt}}%
        \vbox to10pt{\hbox{hello}}%

As far as I can tell, this also works with less exotic document class choices, like article:


Is that at least vaguely what you're looking for?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .