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'm getting really confused by this. In my code, line 39 is completely blank, there's no errors anywhere else and everything fits in the margins yet I'm still getting an Overfull \hbox (34.204pt too wide) in paragraph error. It has nothing to do with what's on the line, because empty or not, the error is always line 39. I've included my code below, does anyone else have this problem?

\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mcode}

\renewcommand{\arraystretch}{1.5}
\renewcommand{\theenumi}{(\roman{enumi})}
\renewcommand{\labelenumi}{\theenumi}

% \mcodelisting{Program/Function descriptor}{Usage}{filename with extension}
\newcommand{\mcodelisting}[3]{\pagebreak
\appendix{\textbf{#1} \mcode{2-3/#3} \textbf{#2}}
\lstinputlisting{C:/Users/******/Documents/MATLAB/2-3/#3}
}


\title{2.3 Continued Fractions}         % used by \maketitle
\author{}
\date{}

\begin{document}
\maketitle

\section*{Rational Numbers}

\subsubsection*{Programming Task}
A program using the given algorithm to compute the partial quotients and convergents of a fraction $u/v$ is shown on page ??.


\begin{enumerate}
\item Taking $u = 112, v = 27$ gives partial quotients $a_n$ as 4,6,1,3 and convergents $p_n/q_n$ as $\frac{4}{1}, \frac{25}{6}, \frac{29}{7}, \frac{112}{27}$
\item Taking $u = 4803, v = 3395$ gives partial quotients 1,2,2,2,3,6 and 13 with convergents $\frac{1}{1}, \frac{3}{2}, \frac{7}{5}, \frac{17}{12}, \frac{58}{41}, \frac{365}{258}, \frac{4803}{3395}$
\item Taking $u = 276272, v = 72159$ gives partial quotients 3,1,4,1,5,9,2,6,5 and 3 with convergents $\frac{3}{1}, \frac{4}{1}, \frac{19}{5}, \frac{23}{6}, \frac{134}{35}, \frac{1229}{321},     \frac{2592}{677}, \frac{16781}{4383}, \frac{86497}{22592}, \frac{276272}{72159}$
\item Finally, if $u = 11683474147$ and $v = 863334886$ then the partial quotients are 13,1,1,7,11,1,2,5,2,3,1,1,9,1,2,12,9,5 and the convergents are $\frac{1}{1}$
\end{enumerate}


% Page break inserted by \mcodelisting
\mcodelisting{Program}{for question 1}{question1.m}

\end{document}             % End of document.

(Line 39 in this case is the blank line immediately before % Page break ...)

share|improve this question

migrated from stackoverflow.com Apr 8 '12 at 2:33

This question came from our site for professional and enthusiast programmers.

1  
What I can say so far is that the problem only appears when using \mcodelisting{Program}{for question 1}{question1.m}. Without that line it compiles just fine. Now I'm not sure wether the problem lies in the mcode package or your newcommand definition but I would guess it's because of the way your mcodelisting is defined. –  Philipp Apr 8 '12 at 4:17
2  
Edit: How does your m-file look like? When I use just some m-file of mine I can also compile just fine. Meaning the newcommand works normal and the mcode package also does its job. –  Philipp Apr 8 '12 at 4:25

1 Answer 1

The problem seems to be that your m-file contains too long lines.

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.