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 am trying to add line numbers to a reading passage. The issue is that I can't get them to display when I try to number lines within a minipage environment. Can anyone answer what seems to be a simple problem?

\documentclass[letterpaper,12pt]{book}
\usepackage{lineno}
\usepackage{lipsum}

\newsavebox{\fmbox}
\newenvironment{fmpage}[1]
{\begin{lrbox}{\fmbox}\begin{minipage}{#1}}
{\end{minipage}\end{lrbox}\fbox{\usebox{\fmbox}}} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

Introduction:  \\

\lipsum[1]

\begin{center} 
\begin{fmpage}{5in}
\vspace{.25cm} % Maybe look into frame sep
{ %
Satellites \\

\modulolinenumbers[2]
\begin{linenumbers}
When you watch the news and see pictures of weather from around the United States 
or the world, you are seeing data from NOAA's environmental satellites. NOAA's 
environmental satellites provide data from space to monitor the Earth to analyze the 
coastal waters, relay life-saving emergency beacons, and track tropical storms and 
hurricanes. 
\end{linenumbers}

\ldots and then there are some multiple-choice questions about it.
}
\vspace{.25cm}
\end{fmpage} \end{center}%
\end{document}
share|improve this question
    
Welcome to TeX.sx! –  Jubobs Mar 18 '13 at 21:57
    
If you add \linenumbers after \usepackage{lineno}, you'll see that the entire block - minipage - is considered as a "line". That's how lineno works. –  Werner Mar 18 '13 at 22:35
    
Useful Related Question: Add page and line numbers to a pdf. –  Peter Grill Mar 18 '13 at 22:46
    
So what you are saying, @Werner, is that my problem has no solution? Would another framing environment work? –  Calhistorian Mar 18 '13 at 22:52
    
@Calhistorian: The problem is that using a minipage means that the contents has to be gathered/assembled into a block, and the setting of it (at which time line numbers are added) is then void of any idea of having lines; it's now just a block of "something" that fits on a "very tall line." Is the eventual output you're interested in a line-numbered block of framed text of specific width? –  Werner Mar 18 '13 at 23:27
show 3 more comments

1 Answer 1

up vote 5 down vote accepted

The package lineno provides the possibility to add frame numbers inside boxes by internallinnumbers

Here the resulting mwe:

\documentclass[letterpaper,12pt]{book}
\usepackage{lineno}
\usepackage{lipsum}

\newsavebox{\fmbox}
\newenvironment{fmpage}[1]
{\begin{lrbox}{\fmbox}\begin{minipage}{#1}}
{\end{minipage}\end{lrbox}\fbox{\usebox{\fmbox}}} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

Introduction:  \\

\lipsum[1]

\begin{center} 
\begin{fmpage}{5in}
\vspace{.25cm} % Maybe look into frame sep
{ %
Satellites \\

\modulolinenumbers[2]
\begin{internallinenumbers}
When you watch the news and see pictures of weather from around the United States 
or the world, you are seeing data from NOAA's environmental satellites. NOAA's 
environmental satellites provide data from space to monitor the Earth to analyze the 
coastal waters, relay life-saving emergency beacons, and track tropical storms and 
hurricanes. 
\end{internallinenumbers}

\ldots and then there are some multiple-choice questions about it.
}
\vspace{.25cm}
\end{fmpage} \end{center}%
\end{document}

enter image description here

share|improve this answer
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.