LaTeX forum ⇒ Text FormattingHow to control underline length

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

How to control underline length

Postby Jill D Holloman » Fri Mar 15, 2019 6:19 pm

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.

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

Postby Stefan Kottwitz » Sat Mar 16, 2019 11:42 am

Hi Jill,

welcome to the forum!

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

  1. \documentclass{article}
  2. \begin{document}
  3. \noindent
  4. \underline{\makebox[\textwidth][c]{Some text}}
  5. \end{document}

Site admin

Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 3 guests