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

  • 1
    Show us the table. It's the only way we can understand what you are talking about. – Werner Jan 23 '15 at 3:56
  • 1
    Ideally show us the table in the form of a complete, but minimal example (or see here). – jon Jan 23 '15 at 4:01
  • I just added a picture – lopedoes Jan 23 '15 at 4:05
  • 1
    The actual LaTeX code is more useful, actually. But maybe try something like a p-column specifier (e.g., instead of having {|l|l|}, try something like {|l|p{1cm}|}. But, really, it helps to see your actual input/code. – jon Jan 23 '15 at 4:32
  • Unrelated to your question, but Vpp and Vrms should most likely be $V_{\textrm{pp}}$ and $V_{\textrm{rms}}$ instead. – Paul Gessler Jan 23 '15 at 11:46
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}
  • How to put a header of the blank column? – alhelal Mar 13 '18 at 0:42
  • @alhelal: Consider this code (output). – Werner Mar 13 '18 at 4:20
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.