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 making a template that I can use for my résumé and CV which uses a horizontal line underneath section titles. I'm running into a problem where, when a page is nearly full, then the vertical whitespace near the line is adjusted so that it runs into the section title and looks horrible. I'd prefer if LaTeX just put the last line of the page onto the next page, rather than cramming it in and adjusting the whitespace.

In response to this problem, I've been trying to disable any kind of "glue" that I can find, but to no avail. Mostly everything I've tried is in the examples below. I'm including two examples, one in which the page isn't full, and one in which it is, so you can see the difference. The first picture is from the code below, but with the second and third paragraphs removed.

I apologize if this issue has already been addressed elsewhere, but I can't find a good solution. Also, please feel free to suggest improvements which are not directly related to my question. This is the first time I'm building a template like this from scratch, and I'm sure I'm doing it wrong (and breaking all the rules of typography). Thanks!

\documentclass[12pt]{article}
\usepackage[left=.95in,right=.95in,top=.95in,bottom=.95in]{geometry}
\pagestyle{empty}
\raggedbottom

\setlength{\parindent}{0in}
\setlength{\leftskip}{4pt}
\setlength{\rightskip}{\leftskip}
\setlength{\lineskiplimit}{-100pt}
\setlength{\baselineskip}{11pt plus 0pt minus 0pt}
\setlength{\normalbaselineskip}{11pt plus 0pt minus 0pt}
\setlength{\lineskip}{11pt plus 0pt minus 0pt}
\setlength{\normallineskip}{11pt plus 0pt minus 0pt}
\setlength{\parskip}{1pt plus 0pt minus 0pt}
\setlength{\topskip}{0pt plus 0pt minus 0pt}

\newcommand{\sect}[1]{\addvspace{15pt plus 0pt minus 0pt} {\large{\textsc{#1}}}%
 \begin{center} \addvspace{-21pt plus 0pt minus 0pt} \line(1,0){474} \end{center}
 \addvspace{-10pt plus 0pt minus 0pt} \par}
\newcommand{\plain}[1]{%
 \begingroup \addtolength{\leftskip}{1pt} \addtolength{\rightskip}{1pt} #1 \par \endgroup 
 \addvspace{5pt plus 0pt minus 0pt}}

\begin{document}

\sect{Section}
\plain{Text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text.}
\plain{Text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text.}
\plain{Text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text  
       text text text text text text text text text text text text text text.}

\end{document}

Example 1 Example 2

share|improve this question
    
Welcome to TeX.SX! See also this very similar question. –  henrique Oct 12 '13 at 1:34
1  
    
Perhaps a mix of tex.stackexchange.com/a/84062/17423 and \setcounter{secnumdepth}{0} will get you the result you need. At any rate, I'd use \hrule instead of \line. –  Sean Allred Oct 12 '13 at 4:19
    
Some of your settings are not obeyed, for instance \baselineskip will be the same as the default (and indeed 11pt with a 12pt font size would produce a very crowded and unreadable output). You forget that center adds \topsep glue. –  egreg Oct 12 '13 at 8:55
    
upi can force the section title to have the depth of a descender by adding \strut to its content. there will still be an attempt to close up available space, but the depth of the strut won't be recognized as space. –  barbara beeton Oct 12 '13 at 17:49
show 1 more comment

1 Answer

Even using TeX you need to make something by hand. So you may use \pagebreak somewhere inside last but one line or better on line last but two to avoid widow. Sometimes it is possible to allow widow lowering \widowpenalty value (150 is the default value while 10000 should't allow any widow). However in your case even \widowpenalty = 0 doesn't help.

\documentclass[12pt]{article}
\usepackage[left=.95in,right=.95in,top=.95in,bottom=.95in]{geometry}
\pagestyle{empty}
\raggedbottom

\setlength{\parindent}{0in}
\setlength{\leftskip}{4pt}
\setlength{\rightskip}{\leftskip}
\setlength{\lineskiplimit}{-100pt}
\setlength{\baselineskip}{11pt plus 0pt minus 0pt}
\setlength{\normalbaselineskip}{11pt plus 0pt minus 0pt}
\setlength{\lineskip}{11pt plus 0pt minus 0pt}
\setlength{\normallineskip}{11pt plus 0pt minus 0pt}
\setlength{\parskip}{1pt plus 0pt minus 0pt}
\setlength{\topskip}{0pt plus 0pt minus 0pt}

\newcommand{\sect}[1]{\addvspace{15pt plus 0pt minus 0pt}{\large{\textsc{#1}}}%
 \begin{center} \addvspace{-21pt plus 0pt minus 0pt} \line(1,0){474}\end{center}
\addvspace{-10pt plus 0pt minus 0pt} \par}
\newcommand{\plain}[1]{%
\begingroup \addtolength{\leftskip}{1pt} \addtolength{\rightskip}{1pt} #1 \par \endgroup 
\addvspace{5pt plus 0pt minus 0pt}}

\begin{document}

\sect{Section}
\plain{Text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text.}
\plain{Text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text.}
\plain{Text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   \pagebreak text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text  
   text text text text text text text text text text text text text text.}

\end{document}
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.