Make the line down in parbox parbox Why do I get a line in the middle? \documentclass{article} \begin{document} %%\parbox[alignment][height][inner-alignment]{width}{text} The answer is:\parbox[c][][b]{2cm}{\hrulefill}.\par \end{document} Best Answer A \parbox is certainly not the right tool for this job. If you want a 2cm wide rule sitting at mid height of lowercase letters, you can do \documentclass{article} \newcommand{\middlerule}[2][0.4pt]{% \raisebox{\dimexpr0.5ex-(#1)/2}{\rule{#2}{#1}}% } \begin{document} The answer is:~\middlerule{2cm} \end{document} Or, with the \vrule primitive, \documentclass{article} \newcommand{\middlerule}[2][0.4pt]{% \vrule height \dimexpr0.5ex+(#1)/2\relax depth \dimexpr(#1)/2-0.5ex\relax width #2\relax } \begin{document} The answer is:~\middlerule{2cm} \end{document} With either version, the input The answer is:~\middlerule[1pt]{2cm} would produce a 1pt thick rule. Related Solutions Related Question
Best Answer
A
\parbox
is certainly not the right tool for this job.If you want a 2cm wide rule sitting at mid height of lowercase letters, you can do
Or, with the
\vrule
primitive,With either version, the input
would produce a 1pt thick rule.