4

I am using pgfornament to draw line separators.

It works perfectly, but in this case, I want to place the line separator inside a column, but I get errors...

This is the MWE I made:

\documentclass[xcolor={dvipsnames,table}, hyperref={unicode}]{beamer}
\usepackage{etex}
\reserveinserts{28}
\setbeameroption{hide notes}

\mode<presentation> {
    \usetheme{Singapore}
    \usecolortheme{orchid}
    \usepackage[dvipsnames]{xcolor}%before tikz
    \usepackage[absolute,overlay]{textpos} %for positioning
    \usepackage{tikz}
    \usetikzlibrary{calc}
    \usepackage{graphicx} %Allows including images
    \setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line

    \usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox
    \usetikzlibrary{positioning,shadows,calc,mindmap,trees,shapes,
    decorations.pathreplacing}%calc is already called in the beamerthemeSIgN.sty file!
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.7}%http://tex.stackexchange.com/questions/81899/what-does-running-in-backwards-compatibility-mode-mean-and-what-should-i-fix-t


    \usepackage{multicol}
    \usepackage{multirow}


    %line separator
    \usepackage[object=vectorian]{pgfornament}
    \newcommand{\sectionline}[3]{%
        \nointerlineskip \vspace{.5\baselineskip}\hspace{\fill}{
            \resizebox{0.5\linewidth}{#3}{
                \pgfornament[color = #1]{#2}
            }
        }
        \hspace{\fill}
        \par\nointerlineskip \vspace{.5\baselineskip}
    }


    \usefonttheme{serif} % default family is serif
    \usepackage{fontspec}

    \usepackage{lmodern}% http://ctan.org/pkg/lm
    \defaultfontfeatures{Mapping=tex-text}
}


\begin{document}
%\mode* % same as ignorenonframetext

\section{Unit 1}
\subsection{}
\begin{frame}
\frametitle{My title}
\begin{columns}[T] % align columns
\begin{column}{.4\textwidth}
    \includegraphics[width=\linewidth]{example-image}
\end{column}%
\hfill%
\begin{column}{.6\textwidth}
    \setlength{\leftmargini}{0pt}
    \begin{itemize}
    \itemsep0.5em
        \item Some text here
    \end{itemize}
    \hspace{30pt} More text here...
    %\sectionline{blue}{88}{0.75ex} %I WANT THIS HERE, BUT DOESN'T WORK!
\end{column}%
\end{columns}
\sectionline{blue}{88}{0.75ex} %IT ONLY WORKS HERE
\begin{itemize}
\itemsep0.5em
    \item more and more and more text
    \item and yes! more text
\end{itemize}

\note{}
\end{frame}


\end{document}

This MWE produces thisthis.

However, I want the line separator NEXT TO the image, NOT UNDER it...

If I place the line separator inside the column I get the error:

You can't use `\prevdepth' in horizontal mode.

Any help?

  • 1
    I don't understand your code. But I've seen that second \nointerlineskip was preceded by \par and first not. Adding it before first \nointerlineskip your code compiles. Although I don't know if the result is what you want. – Ignasi Jun 8 '16 at 7:23
3

The error message is ! You can't use '\prevdepth' in horizontal mode. You may add a blank line before \sectionline to leave horizontal mode or, as suggested by Ignasi's comment, you may add \par before the first call to \nointerlineskip into the definition of \sectionline.

enter image description here

\documentclass[xcolor={dvipsnames,table}, hyperref={unicode}]{beamer}
\usepackage{etex}
\reserveinserts{28}
\setbeameroption{hide notes}

\mode<presentation> {
    \usetheme{Singapore}
    \usecolortheme{orchid}
    \usepackage[dvipsnames]{xcolor}%before tikz
    \usepackage[absolute,overlay]{textpos} %for positioning
    \usepackage{tikz}
    \usetikzlibrary{calc}
    \usepackage{graphicx} %Allows including images
    \setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line

    \usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox
    \usetikzlibrary{positioning,shadows,calc,mindmap,trees,shapes,
    decorations.pathreplacing}%calc is already called in the beamerthemeSIgN.sty file!
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.7}%http://tex.stackexchange.com/questions/81899/what-does-running-in-backwards-compatibility-mode-mean-and-what-should-i-fix-t


    \usepackage{multicol}
    \usepackage{multirow}


    %line separator
    \usepackage[object=vectorian]{pgfornament}
    \newcommand{\sectionline}[3]{%
        \nointerlineskip \vspace{.5\baselineskip}\hspace{\fill}{
            \resizebox{0.5\linewidth}{#3}{
                \pgfornament[color = #1]{#2}
            }
        }
        \hspace{\fill}
        \par\nointerlineskip \vspace{.5\baselineskip}
    }


    \usefonttheme{serif} % default family is serif
    \usepackage{fontspec}

    \usepackage{lmodern}% http://ctan.org/pkg/lm
    \defaultfontfeatures{Mapping=tex-text}
}


\begin{document}
%\mode* % same as ignorenonframetext

\section{Unit 1}
\subsection{}
\begin{frame}
\frametitle{My title}
\begin{columns}[T] % align columns
\begin{column}{.4\textwidth}
    \includegraphics[width=\linewidth]{example-image}

    \sectionline{orange}{88}{0.75ex}
\end{column}%
\hfill%
\begin{column}{.6\textwidth}
    \setlength{\leftmargini}{0pt}
    \begin{itemize}
    \itemsep0.5em
        \item Some text here
    \end{itemize}
    \hspace{30pt} More text here...

    \sectionline{magenta}{88}{0.75ex} %I WANT THIS HERE, BUT DOESN'T WORK!
\end{column}%
\end{columns}
\sectionline{blue}{88}{0.75ex} %IT ONLY WORKS HERE
\begin{itemize}
\itemsep0.5em
    \item more and more and more text
    \item and yes! more text
\end{itemize}

\note{}
\end{frame}


\end{document}
  • Oh that easy? Why wasn't I aware of this? Many thanks!! – DaniCee Jun 8 '16 at 7:33
  • Are your answer and my comment equivalent solutions? – Ignasi Jun 8 '16 at 10:42
  • @Ignasi A blank line and \par are equivalent. But your solution seems more robust in current context. – Paul Gaborit Jun 8 '16 at 11:09

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.