3

I'm planning on cleaning up a large TeX file for viewing on an e-reader (hence, small page size), and as I'm new to TeX I'm practicing on a sample file and following these instructions. However, I'm having trouble resolving an overfull hbox using common fixes. Given the following TeX (full document at end):

\begin{enumerate}
\item {\small First Subpoint (Small Font)} 
\item {\tiny Second Subpoint (Tiny Font)} 
\item {\Huge Third Subpoint (Huge Font)} 
\end{enumerate}

Bad wrap



I tried adjusting \pretolerance, which had no effect and \sloppypar was, well, sloppy: Sloppypar



Probably the best look would just be for "regular" spacing of "Third Subpoint", left justified, with "(Huge Font)" on the line below. But I'm not sure what spacing or justification setting to use to resolve the problem (or why the line width is "invalid" without sloppy). Any suggestions would be very much appreciated. Thank you!


\documentclass[10pt]{article}

\usepackage[font=small,labelformat=simple,]{caption} 

\usepackage{titlesec} 
\titleformat{\section}{\itshape\large}{}{0em}{}
\titlespacing{\section}{0pt}{8pt}{4pt}
\titleformat{\subsection}{\itshape}{}{0em}{}
\titlespacing{\subsection}{0pt}{4pt}{2pt}
\titleformat{\subsubsection}[runin]{\bf\scshape}{}{0em}{}
\titlespacing{\subsubsection}{0pt}{5pt}{5pt}

\usepackage[papersize={3.6in,4.8in}, hmargin=0.1in,vmargin={0.1in,0.1in}]{geometry} 

\usepackage{fancyhdr} 
\pagestyle{fancy}
\fancyhead{}            
\fancyfoot{}            

\setlength{\abovecaptionskip}{2pt} 
\setlength{\belowcaptionskip}{0pt} 
\setlength{\textfloatsep}{2pt}     
\setlength{\floatsep}{2pt}         
\setlength{\intextsep}{2pt}        

\usepackage{amssymb,latexsym,amsmath}     % Standard packages
\usepackage{breqn,microtype}

\newtheorem{theorem}{Theorem}
\newenvironment{proof}{\noindent{\bf Proof:}}{$\hfill \Box$}  


\begin{document}

\title{Sample \LaTeX ~File}
\author{David P. Little}
\maketitle

\begin{abstract}
This document represents the output from the file ``sample.tex" once compiled using your favorite \LaTeX compiler.  This file should serve as a good example of the basic structure of a ``.tex" file as well as many of the most basic commands needed for typesetting documents involving mathematical symbols and expressions.  For more of a description on how each command works, please consult the links found on our course webpage.
\end{abstract}


\section{Lists}
\begin{enumerate}
\item {\bf First Point (Bold Face)}
\item {\em Second Point (Italic)}
\item {\Large Third Point (Large Font)}
    \begin{enumerate}
        \item {\small First Subpoint (Small Font)} 
        \item {\tiny Second Subpoint (Tiny Font)} 
        \item {\Huge Third Subpoint (Huge Font)} 
    \end{enumerate}
\item[$\bullet$] {\sf Bullet Point (Sans Serif)}
\item[$\circ$] {\sc Circle Point (Small Caps)} 
\end{enumerate}


\section{Equations}

\subsection{Binomial Theorem}
\begin{theorem}[Binomial Theorem]
For any nonnegative integer $n$, we have
$$(1+x)^n = \sum_{i=0}^n {\binom{n}{i}} x^i$$
\end{theorem}

\subsection{Taylor Series}
The Taylor series expansion for the function $e^x$ is given by
\begin{equation}
e^x = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \cdots = \sum_{n\geq 0} \frac{x^n}{n!}
\end{equation}


\subsection{Sets}

\begin{theorem}
For any sets $A$, $B$ and $C$, we have
$$ (A\cup B)-(C-A) = A \cup (B-C)$$
\end{theorem}

\begin{proof}
\begin{eqnarray*}
(A\cup B)-(C-A) &=& (A\cup B) \cap (C-A)^c\\
&=& (A\cup B) \cap (C \cap A^c)^c \\
&=& (A\cup B) \cap (C^c \cup A) \\
&=& A \cup (B\cap C^c) \\
&=& A \cup (B-C)
\end{eqnarray*}
\end{proof}


\section{Tables}
\begin{center}
\begin{tabular}{l||c|r}
left justified & center & right justified \\ \hline
1 & 3.14159 & 5 \\
2.4678 & 3 &  1234 \\ \hline \hline
3.4678 & 6.14159 & 1239
\end{tabular}
\end{center}


\section{A Picture}
\begin{center}
\begin{picture}(100,100)(0,0)
\setlength{\unitlength}{1pt}
\put(20,70){\circle{30}}  \put(20,70){\circle*{10}}   % left eye
\put(80,70){\circle{30}}  \put(80,70){\circle*{10}}   % right eye
\put(40,40){\line(1,2){10}} \put(60,40){\line(-1,2){10}} \put(40,40){\line(1,0){20}} % nose
\put(50,20){\oval(80,10)[b]} % mouth
\multiput(0,90)(4,0){10}{\line(1,3){4}}  % left eyebrow
\multiput(100,90)(-4,0){10}{\line(-1,3){4}}  % right eyebrow
\end{picture}
\end{center}


\end{document}
  • When justification becomes a problem (typical of smaller spaces), using a \raggedright approach (perhaps with the inclusion of ragged2e) is sometimes better. microtype can also help... – Werner Apr 22 '14 at 17:58
  • never use a font size change like {\small xxx} without including \par or equivalently a blank line before the } {\small xxx\par} otherwise you get small (or large) text set to a normal baseline. \bf, \sc, \sf are all deprecated commands just there for compatibility with LaTeX2.09 (ie documents from the 1980's) – David Carlisle Apr 22 '14 at 18:14
  • \raggedright was perfect! Thank you! (@Werner, Can you post as an answer so that I can accept?) – mjbraun Apr 22 '14 at 18:29
1

When justification becomes a problem (typical of smaller horizontal spaces), using a \raggedright approach (perhaps with the inclusion of ragged2e) is sometimes better. microtype can also help...

Also, when mixing-and-matching different font sizes, be sure that a paragraph is set (via an explicit \par or an empty line) in order for the baseline skips to be corrected.

| improve this answer | |

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.