Here is a repro for my problem:
\documentclass[10pt]{article}
\usepackage[
a4paper,
top=2.5cm,
bottom=2.5cm,
left=2.5cm,
right=2.5cm
]{geometry}
\usepackage{booktabs}
\begin{document}
\toprule
\vspace{7pt}
Foo
\vspace{7pt}
\toprule
\end{document}
This gives me an error on both \toprule lines:
Misplaced \noalign
However, overleaf still compiles and displays the PDF (which I don't really understand):
As best I can tell, it's because I'm using it outside the context of a tabular environment.
But how can I achieve exactly the same effect outside a table?
I found this answer, which leads to code like this:
\documentclass[10pt]{article}
\usepackage[
a4paper,
top=2.5cm,
bottom=2.5cm,
left=2.5cm,
right=2.5cm
]{geometry}
\usepackage{booktabs}
\begin{document}
\noindent\makebox[\textwidth]{\rule{\textwidth}{0.4pt}}
\vspace{7pt}
Foo \\
\noindent\makebox[\textwidth]{\rule{\textwidth}{0.4pt}}
\end{document}
But this does not align the line vertically in the same manner:
Can anyone tell me how to do horizontal ruling in the same manner outside a table as in?





ruledown further? The toprulespecifies1ex, but that's to control added space below therule. How do I control space above the rule? Addingvspaceseems to just push stuff down that is after therule, not theruleitself. – me-- Apr 16 '19 at 08:01