Graphics, Figures & TablesHow to create an underline for remaining column space

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
LavaTyper
Posts: 69
Joined: Sat Feb 11, 2012 2:38 am

How to create an underline for remaining column space

Post by LavaTyper »

How do I create a two-column table such that, in the second column, I have a few words in each row followed by an underline that fills the remaining space in the column?

I've searched all over the internet, the guides, and this forum, but I can't seem to find an answer. It should be pretty simple.

Code: Select all

\documentclass[11pt]{article}
\usepackage{tabularx}
\begin{document}


\begin{center}
\begin{tabularx}{\dimexpr\textwidth-0.4in}{p{0.2in}X}
{\bf 1)} & What is the answer to this question? \rule{...what goes here...} \vspace{24pt} \\
& How do you know? \rule{...what goes here...}
\end{tabularx}
\end{center}


\end{document}

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
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

How to create an underline for remaining column space

Post by cgnieder »

\hrulefill should do:

Code: Select all

\documentclass[11pt]{article}
\usepackage{tabularx}
\begin{document}


\begin{center}
\begin{tabularx}{\dimexpr\textwidth-0.4in}{p{0.2in}X}
{\bf 1)} & What is the answer to this question? \hrulefill \vspace{24pt} \\
& How do you know? \hrulefill
\end{tabularx}
\end{center}


\end{document}
Regards
site moderator & package author
Post Reply