14

I am using the columns environment in Beamer-documents like this:

\begin{columns}
    \begin{column}{0.8\textwidth}
       %%
    \end{column}
    \begin{column}{0.2\textwidth}
       %%
    \end{column}
\end{columns}

I am getting tired of having to change the width of the second column each time I adjust the first one.

Basically I am searching for a columns environment where the column-width-argument is optional - if you don't specify it is computed like this:

 max(0, (complete_width - sum_of_explicitly_specified_width) / number_of_implicit_cols)

How can setup something like this with LaTeX?

1
  • A system that works like tabularx would be nice, where you have a “virtual”, unspecified length x so that one can define column lengths by means of x. E. g. first column 1x and second column 2x gives a 1st column with length 1/3\linewidth-columngap/2 and a second with 2/3\linewidth-columngap/2. Unfortunately I can't provide such a solution ...
    – Chris
    Oct 29, 2012 at 16:48

1 Answer 1

10

For two columns this is fairly straight forward. Define a length to hold the first column's width and use this length in a calculation of the second column:

% In preamble (to separate structure from contents)
%...
\newlength{\mylen}

% In document/frame
%...
\begin{columns}
  \setlength{\mylen}{0.8\textwidth}
  \begin{column}{\mylen}
    %%
  \end{column}
  \begin{column}{\dimexpr\textwidth-\mylen}
    %%
  \end{column}
\end{columns}
1
  • 3
    I believe columns adds some separation between the columns; this is not taken into account here. Also, shouldn’t it be subtracted from \linewidth? Apr 13, 2016 at 8:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .