Edit:
Here is a redefinition of the environment columns and it's column command to
contain vertical lines between the columns with the help of tikz
overlay
.
The way I used is by adding a \tikzmark
to the beginning of each column and then calculating the middle point between this \tikzmark + the width of the command and the next column's \tikzmark
. Also I used a similar trick for calculating the height of the columns
(redefined) environment.
My columns
environment, takes an optional argument with 3 comma separated different options:
- First is the alignment option of the
\oldcolums
environment (like t
for top, b
for bottom and c
for centered vertical aligned columns)
- Second option is the width of the vertical line that will be added (after second compilation -because it is added as an overly-) between the columns.
- The third option is the color of the above vertical lines.
You may add 1, 2 or 3 options in this optional argument, but the order must be the above.
The final code:
\documentclass[8pt]{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcounter{mycolcounter}
\newcounter{mylinecounter}
\newcounter{tempcounter}
\newcounter{tempcounterB}
\newlength\availafter
\newlength\initialtextwidth
\newcommand\tikzmark[1]{\begin{tikzpicture}[overlay,remember picture]\coordinate (#1);\end{tikzpicture}}
\newcommand\DrawLines[3]{\draw[line width=\ArgB,color=\ArgC]let\p1=(#1),\p2=(#2),\p3=(#3)in($(\x1,0)+({(\x2+\x3+\csname ColWidth\Alph{tempcounter}\endcsname)/2},\y1)$)--($(\x1,0)+({(\x2+\x3+\csname ColWidth\Alph{tempcounter}\endcsname)/2},{\textheight-\availafter})$);}
\newcommand\lcolumn[1]{\stepcounter{mycolcounter}\setlength\textwidth{\initialtextwidth}\xdef\temp{\the\dimexpr#1}\expandafter\expandafter\expandafter\global\expandafter\let\csname ColWidth\Alph{mycolcounter}\endcsname\temp\oldcolumn{#1}\tikzmark{ColStart\Alph{mycolcounter}}}
\let\oldcolumns\columns%
\let\endoldcolumns\endcolumns%
\renewenvironment{columns}[1][c]{%
\xdef\ArgA{c}%
\xdef\ArgB{1pt}%
\xdef\ArgC{black}
\xdef\Arg{#1}%
\setlength{\initialtextwidth}{\textwidth}%
\tikzmark{ColStart}%
\setcounter{mycolcounter}{0}%
\setcounter{mylinecounter}{0}%
\foreach \k[count=\m from 0] in \Arg {\ifnum\m=0\xdef\ArgA{\k}\else\ifnum\m=1\xdef\ArgB{\k}\else\xdef\ArgC{\k}\fi\fi}
\oldcolumns[\ArgA]\let\oldcolumn\column\let\column\lcolumn%
}{%
\endoldcolumns%
\setcounter{mylinecounter}{\numexpr\the\value{mycolcounter}-1\relax}%
\setlength{\availafter}{\dimexpr\textheight-\pagetotal\relax}%
\setcounter{tempcounter}{0}%
\setcounter{tempcounterB}{1}%
\foreach \col[count=\i from 0]in{1,...,\arabic{mylinecounter}}{%
\stepcounter{tempcounter}%
\stepcounter{tempcounterB}%
\begin{tikzpicture}[overlay,remember picture]%
\DrawLines{ColStart}{ColStart\Alph{tempcounter}}{ColStart\Alph{tempcounterB}}%
\end{tikzpicture}%
}%
\let\column\oldcolumn%\
}
\begin{document}
\begin{frame}
\frametitle{Lorem Ipsum}
\begin{columns}
\column{0.25\textwidth}%
\noindent1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.25\textwidth}%
\noindent1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.25\textwidth}%
\noindent1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\end{columns}
\begin{columns}[c,0.1pt,blue]
\column{0.3\textwidth}%
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.4\textwidth}%
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.2\textwidth}%
\large 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\end{columns}
\begin{columns}[b,0.3pt]
\column{0.33\textwidth}%
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.43\textwidth}%
\scriptsize1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.23\textwidth}%
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\end{columns}
\begin{columns}[t,2pt,green]
\column{0.23\textwidth}%
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.23\textwidth}%
\footnotesize 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.23\textwidth}%
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\end{columns}
\begin{columns}[c,2pt,red]
\column{0.23\textwidth}%
\tiny1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\column{0.53\textwidth}
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \\
\begin{tikzpicture}[inner sep=0,outer sep=0]
\draw[<->] (0,0)--(\textwidth,0);
\end{tikzpicture}
\end{columns}
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
\end{frame}
\end{document}
Output:

\midrule
– Niklas Aug 16 '19 at 7:35\midrule
supposed to create a vertical rule? As far as I knw, a\midrule
is horizontal. – leandriis Aug 16 '19 at 7:41\vrule{}
works altough I can't get it to work between the two of them, just in the front of the first column. – Niklas Aug 16 '19 at 7:42