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.

I would like everyline of a presentation to be numbered. Like the lineno package will do.

I tried the following but it does not print line numbers. I don't see why, I know there are some \par caveats. But I don't really understand them.

\documentclass{beamer}
\usepackage[mathlines]{lineno}

\linenumbers

\begin{document}

\begin{frame}

    A floating line

    \begin{theorem}
        Some line in a theorem
    \end{theorem}

    \begin{linenomath}
        \begin{eqnarray*}
            x + y 
        \end{eqnarray*} 
    \end{linenomath}

\end{frame}

\end{document}

output

share|improve this question

1 Answer 1

up vote 4 down vote accepted

As mentioned in the lineno manual, line numbers do not automatically apply to boxed material. In beamer each slide is typeset as a box, hence no numbers. Thus you will need to add \internallinenumbers and possibly appropriate \resetlinenumber[<number>] statement to each frame:

\documentclass{beamer}
\usepackage{lineno}
\linenumbers
\begin{document}

\begin{frame}
  \internallinenumbers
  A line

  Another line

  A very long line.
   A very long line.
    A very long line.
     A very long line.
      A very long line.
       A very long line.

  Some maths: $y = mx + c$

  \begin{linenomath*}
    \begin{equation}
      y = mx + c
    \end{equation}
  \end{linenomath*}

\end{frame}

\end{document}

enter image description here

As you'll notice, the way beamer sets display maths (and other stuff) 'behind the scenes' means that the numbering can be a bit odd. If just numbering text is acceptable then

\documentclass{beamer}
\usepackage{lineno}
\linenumbers
\begin{document}

\begin{frame}
  \begin{internallinenumbers}
  A line

  Another line

  A very long line.
   A very long line.
    A very long line.
     A very long line.
      A very long line.
       A very long line.

  Some maths: $y = mx + c$
  \end{internallinenumbers}

  \begin{equation}
      y = mx + c
  \end{equation}

\end{frame}

\end{document}

is rather better.

enter image description here

share|improve this answer

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.