Text FormattingHow to control underline length

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Jill D Holloman
Posts: 1
Joined: Fri Mar 15, 2019 6:18 pm

How to control underline length

Post by Jill D Holloman »

Hi there,

I have a question about underline:basically I want to get the effect that make the underline span all the textwidth, is there anyway to achieve it?

I search lots of solution, no luck.

Thanks a lot.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10360
Joined: Mon Mar 10, 2008 9:44 pm

How to control underline length

Post by Stefan Kottwitz »

Hi Jill,

welcome to the forum!

Instead of directly underlining text, you could put that text into a box and underline that box:

Code: Select all

\documentclass{article}
\begin{document}
\noindent
\underline{\makebox[\textwidth][c]{Some text}}
\end{document}
Stefan
LaTeX.org admin
Post Reply