5

This question already has an answer here:

Am looking for an elegant way to include line numbers in my mdframed documents. Unfortunately, the following produces a 85 page docuement with \linenumbers (either before or after the \begin{mdframed}. Document is only 4 pages without the \linenumbers.

References:

  • Am ok with a post processing solution, but was not able to get Jake's solution from Add page and line numbers to a pdf to work. And yes I know that saying "it doesn't work" does not help to figure out what the problem is -- might post a separate question, but thought that using lineno package would be easier.

Code:

\documentclass{article}
\usepackage{lineno}
\usepackage{mdframed}
\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\begin{mdframed}\linenumbers
    \lipsum
    \begin{tikzpicture}
        \draw [fill=yellow!25] (0,0) rectangle (3,4);
    \end{tikzpicture}
    \lipsum
\end{mdframed}
\end{document}

marked as duplicate by Marco Daniel, Peter Grill, Kurt, Thorsten, user2478 Apr 5 '13 at 20:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Is this of any help? – jubobs Apr 5 '13 at 8:31
  • @Jubobs: Yeah I saw that question, but that seems more of a method of manually adding line numbers. I need an automated solution. – Peter Grill Apr 5 '13 at 8:54
  • Have you tried recycling some code for line numbering from the algorithm2e package? – jubobs Apr 5 '13 at 9:01
  • @Jubobs: No have not, but sure if that would work, as the solution I need needs to work with TeX's line breaking algorithm, and I think those packages have their own. – Peter Grill Apr 5 '13 at 9:05
  • The issue isn't related to mdframed. A similar question with minipage can be found here: tex.stackexchange.com/questions/103163/… – Marco Daniel Apr 5 '13 at 17:25