Ok, the title might be confusing. But the idea is pretty simple: I have this text that I would like to add a line on its side, but the line should be centralized vertically into the line, like so:
Any ideas on how to do it? Thanks!
Ok, the title might be confusing. But the idea is pretty simple: I have this text that I would like to add a line on its side, but the line should be centralized vertically into the line, like so:
Any ideas on how to do it? Thanks!
The xhfill package provides tools to customise \hrulefill:
\documentclass[svgnames]{article}
\usepackage{xhfill}
\usepackage{lipsum}
\begin{document}
\textbf{Work Experience} \xrfill[0.5ex]{0.6pt}[Crimson]
\medskip
\lipsum{1}
\end{document}
Here are two ways of accomplishing your goal:
\raisebox{0.5ex}{<code for horizontal rule>}
$\vcenter{\hbox{<code for horizontal rule>}}$
The former raises the rule by 0.5ex, where ex is the font's so-called x-height. The latter places the rule centered on the math axis. (In case you're wondering where the math-axis is located: In math mode, the - (minus) symbol is placed on the math axis, while the = symbol is centered vertically on it.)
The output of the two methods is fairly similar as long as the horizontal rule isn't too thick. In the following screenshot, the length and width of the rules is set to 6em and 0.4pt, respectively. You're obviously free to choose other values.
\documentclass{article}
\begin{document}
\textbf{Experience} \raisebox{0.5ex}{\rule{6em}{0.4pt}} $\vcenter{\hbox{\rule{6em}{0.4pt}}}$
\end{document}
\raisebox{-0.5ex}{\textbf{Experience}} \hrulefill work for you? (You'll probably have to adjust the vertical spacing around this line. Just what the needed adjustment is will depend on what's on the page -- about which you haven't told us much so far...)
– Mico
Jan 09 '21 at 08:02
Following an answer to my past question
\documentclass{article}
\usepackage{tikz}
\begin{document}
Work Experience $\vcenter{\hbox{\begin{tikzpicture}\draw[-] (0,0) -- ++(10mm,0);\end{tikzpicture}}}$
\end{document}