![Como colocar uma régua vertical entre colunas do Beamer criadas com o comando \column?](https://rvso.com/image/400359/Como%20colocar%20uma%20r%C3%A9gua%20vertical%20entre%20colunas%20do%20Beamer%20criadas%20com%20o%20comando%20%5Ccolumn%3F.png)
Nota: Esta questão é diferente dehttps://tex.stackexchange.com/a/95188/18588porque essa pergunta funciona com o column
ambiente, mas esta é sobre o \column
comando.
Meu código:
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Lorem Ipsum}
\begin{columns}[t]
\column{.5\textwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
\column{.5\textwidth}
Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.
\end{columns}
\end{frame}
\end{document}
Isso cria um slide com duas colunas. Quero agora colocar uma linha divisória entre as duas colunas. Eu vi essa resposta emhttps://tex.stackexchange.com/a/95188/18588já e isso funciona bem com \begin{column}
e \end{column}
. Como posso fazê-lo funcionar \column
apenas com o comando?
Responder1
Aqui está uma solução alternativa a que cheguei:
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Lorem Ipsum}
\begin{columns}[T]
\column{.49\textwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
\column{.01\textwidth}
\rule{.1mm}{.7\textheight}
\column{.49\textwidth}
Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit
anim id est laborum.
\end{columns}
\end{frame}
\end{document}
Aqui está a saída:
Aqui estão as alterações feitas no código original fornecido na pergunta:
A opção
t
para ocolumns
ambiente foi alterada paraT
. Aqui está uma descrição desta opção doGuia do usuário do Beamer(Seção 12.7: Dividindo um quadro em múltiplas colunas):T
é semelhante àt
opção, masT
alinha os topos das primeiras linhas enquantot
alinha as chamadas linhas de base das primeiras linhas. Se coisas estranhas parecerem acontecer em conjunto com at
opção (por exemplo, se um gráfico “cair” repentinamente com at
opção em vez de “subir”), tente usar esta opção.A largura das duas colunas contendo texto foi reduzida de
.5\textwidth
para.49\textwidth
para liberar espaço para uma nova coluna de largura.01\textwidth
. Esta nova coluna é colocada entre as duas colunas de texto existentes. Esta nova coluna conteria a regra vertical.Uma regra vertical foi adicionada na nova coluna com o
\rule
comando. Aqui está uma descrição do\rule
comando deA introdução não tão curta ao LATEX 2ε(Seção 6.7: Regras):Algumas páginas atrás você deve ter notado o comando
\rule[lift]{width}{height}
Em uso normal, produz uma caixa preta simples.
\rule{3mm}{.1pt}% \rule[-1mm]{5mm}{1cm}% \rule{3mm}{.1pt}% \rule[1mm]{1cm}{5mm}% \rule{3mm}{.1pt}
Isto é útil para desenhar linhas verticais e horizontais. A linha na página de título, por exemplo, foi criada com um
\rule
comando.
Responder2
Editar:
Aqui está uma redefinição das colunas do ambiente e seu comando de coluna para conter linhas verticais entre as colunas com a ajuda de tikz
overlay
.
A maneira que usei foi adicionando a \tikzmark
ao início de cada coluna e depois calculando o ponto médio entre este \tikzmark + a largura do comando e o da próxima coluna \tikzmark
. Também usei um truque semelhante para calcular a altura do columns
ambiente (redefinido).
Meu columns
ambiente recebe um argumento opcional com três opções diferentes separadas por vírgula:
- A primeira é a opção de alinhamento do
\oldcolums
ambiente (comot
para colunas superiores,b
inferiores ec
centralizadas com alinhamento vertical) - A segunda opção é a largura da linha vertical que será adicionada (após a segunda compilação -porque é adicionada como excesso-) entre as colunas.
- A terceira opção é a cor das linhas verticais acima.
Você pode adicionar 1, 2 ou 3 opções neste argumento opcional, mas a ordem deve ser a acima.
O código final:
\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}
Saída: