3

As I am trying to make a simple table in Latex, I realize the empty column that I created has a really small width. Is there a way that I can increase the space in empty column?

enter image description here

3 Answers3

5

Create a single-column tabular, and specify the width of the space between the right-side double-line:

enter image description here

\documentclass{article}

\begin{document}

\begin{tabular}{|l|@{\hspace{1em}}|}
  \hline
  A \\
  \hline
  B \\
  \hline
\end{tabular}

\begin{tabular}{|l|@{\hspace{2em}}|}
  \hline
  A \\
  \hline
  B \\
  \hline
\end{tabular}

\end{document}
Werner
  • 603,163
2

If you want to have the same width for both columns, you could just insert an \hphantom with the content of the widest left site input.

% arara: pdflatex

\documentclass{article}
\usepackage{array} % fixing the gaps in the vertical lines.

\begin{document}
    \begin{tabular}{|l|l|}
        \hline
        A & \hphantom{A} \\
        \hline
        B & \\
        \hline
    \end{tabular}   
\end{document}

enter image description here

LaRiFaRi
  • 43,807
1

Two alternatives. With the first

\newcommand{\wb}[1]{#1&\phantom{#1}}

the second column will have exactly the same width as the first one, because at each row we add a phantom with the same contents.

With the other possibility

\newcommand{\wb}[1]{#1&\hspace{1cm}}

the second column will have a fixed width, 1cm in this case.

In the example I use \renewcommand just to show both possibilities in the same document. This shows also that using macros leaves you free to decide the format until the last moment.

\documentclass{article}

\newcommand{\wb}[1]{#1&\phantom{#1}}

\begin{document}

\begin{tabular}{|c|c|}
\hline
\wb{A} \\
\hline
\wb{B} \\
\hline
\end{tabular}
\begin{tabular}{|c|c|}
\hline
\wb{Vpp} \\
\hline
\wb{Vrms} \\
\hline
\end{tabular}

\bigskip

\renewcommand{\wb}[1]{#1&\hspace{1cm}}

\begin{tabular}{|c|c|}
\hline
\wb{A} \\
\hline
\wb{B} \\
\hline
\end{tabular}
\begin{tabular}{|c|c|}
\hline
\wb{Vpp} \\
\hline
\wb{Vrms} \\
\hline
\end{tabular}

\end{document}

enter image description here

egreg
  • 1,121,712