Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How to draw vertical dashed line between columns in beamer?

I have found how to make vertical line, but not dashed :(

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

A bit hacky, but with the dashrule package and \rotatebox macro from graphicx you can achieve something like the following (MWE taken from the other question you linked):

enter image description here

\documentclass[demo]{beamer}
\usepackage{dashrule}
\begin{document}
  \begin{columns}[c]
   \begin{column}{0.5\textwidth}
    \includegraphics<1>[width=0.35\textwidth]{picture.jpg}
   \end{column}
   \rotatebox{-90}{\hskip-1.8cm\hdashrule[0.2ex]{5cm}{1pt}{3mm}}
   \begin{column}{0.50\textwidth}
    \hskip10pt
    \includegraphics<1>[width=0.35\textwidth]{picture.jpg}
   \end{column}
  \end{columns}
\end{document}

You need to enclose the \hdashrule macro into a rotatebox and manually adjust the starting point of the rule after the rotation with a \hskip.

You can control the dashing factor, thickness, length, etc. of the rule via the \hdashrule command parameters explained in the package documentation.

TikZ solution

Just for fun, here is a TikZ based alternative solution:

\documentclass[demo]{beamer}
\usepackage{tikz}

\newcommand{\vdashrule}[1]{\tikz[remember picture]\draw[dashed,thick,overlay](current page.north)--+(0,-#1);}

\begin{document}
  \begin{columns}[c]
   \begin{column}{0.5\textwidth}
    \includegraphics<1>[width=0.35\textwidth]{picture.jpg}
   \end{column}
    \vdashrule{3.5}
   \begin{column}{0.50\textwidth}
    \hskip10pt
    \includegraphics<1>[width=0.35\textwidth]{picture.jpg}
   \end{column}
  \end{columns}
\end{document}

I just defined a \vdashrule command that takes advantage of the overlay and remember picture TikZ options, which let you anchor the rule to frame borders (or everywhere else in the frame, if you like).

The length of the rule is specified with an argument and the style can be controlled via the TikZ options.

The visual result is pretty much the same as the previous screenshot.

share|improve this answer
    
Thanks! I like the tikz solution! –  Roah Apr 1 at 18:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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