TeXnik - Tips TeX and LaTeX


Welcome to the TeXnik website (under construction)

Horizontal and Vertical Spacing
TUG logo

Main page

Index
UK FAQ
Documentation
Software
CTAN
Search CTAN:

Statistics

Google c.t.t.

Google d.c.t.t.

 


 


Horizontal space |  linebreak behind paragraph-style |  Linespacing |  Linespacing in Quote/Quotation/Verse |  Paragraph Spacing |  Phantom Spacing |  Space between Text and Footnote |  Space over/under Section-title |  Spacing in ToC/LoT/LoF/ |  Vertical space |  Vertical Space for Chapter Title |  \vspace command | 


Horizontal space
Horizontal space is possible with several commands. But not every solution makes it possible to have linebreaks inside a defined whitespace. Download the LaTeX source to see how it works.
Vertical Space for Chapter Title
Additionally to the predefined vertical spaces there is some space before a chapter title, between and behind the titel:

- space before -
Chapter 1
- space between -
The Chapter Tirle
- space below -

If you want a total vertical space of for example 2 inch, then write the following in the preamble. For another space change one or all of the three values.

\makeatletter
\usepackage{calc}
\newlength{\topspace}
\setlength{\topspace}{2in%   <---- the whole vertical space
    -\topmargin%    <--- predefined
    -\headheight%          ...
    -\headsep%             ...
    -\topskip}             ...
\def\@makechapterhead#1{%
 \vspace*{\topspace}% <---- the space above
 {\parindent \z@ \raggedright \normalfont
   \ifnum \c@secnumdepth >\m@ne
     \if@mainmatter
       \huge\bfseries \@chapapp\space \thechapter
       \par\nobreak
       \vskip 20\p@% <--- the space between Chapter # - title
     \fi
   \fi
   \interlinepenalty\@M
   \Huge \bfseries #1\par\nobreak
   \vskip 40\p@% <---- the space below
 }%
}%
\makeatother

Spacing in ToC/LoT/LoF/
The vertical space between entries are paragraph spaces, so simply use single space but another definition for the parskip:
\begingroup
\setlength{\parskip}{2\baselineskip}
\listoftables
\endgroup
or any other value than "2".


Phantom Space
To get equal inter-line spacing, you could increase the \baselineskip for the eqnarray, but that can be involved. For this case, maybe the best solution is to insert
\vphantom{\frac{1}{2}}
in the equation without a fraction. (\phantom, \hphantom and \vphantom aren't mentioned in many manuals, but they are defined. They leave blank space the size of their argument.)


Quote, Quotation and Verse with another spacing

In a double- or oneandhalf-spced text it's sometimes better to write Quote, Quotation and Verse in single spacing. Than write in LaTeX preamble:

\makeatletter
\renewenvironment{verse}
               {\let\\\@centercr
                \begin{spacing}{1}\list{}{\itemsep \z@
                        \itemindent   -1.5em%
                        \listparindent\itemindent
                        \rightmargin  \leftmargin
                        \advance\leftmargin 1.5em}%
                \item\relax}
               {\endlist\end{spacing}\noindent\hspace{-0.333em}}
\renewenvironment{quotation}
               {\begin{spacing}{1}\list{}{\listparindent 1.5em%
                        \itemindent    \listparindent
                        \rightmargin   \leftmargin
                        \parsep        \z@ \@plus\p@}%
                \item\relax}
               {\endlist\end{spacing}\noindent\hspace{-0.333em}}
\renewenvironment{quote}
               {\begin{spacing}{1}\list{}{\rightmargin\leftmargin}%
               \item\relax}
               {\endlist\end{spacing}\noindent\hspace{-0.333em}}
\makeatother
You can change the value for the spacing. But remeber that these redefinitions only work if you have in layout->document->linespacing other than single spacing! Otherwise write in preamble \usepackage{setspace}.


linebreak behind paragraph-style

some document classes have no linebreak behind the subsubsection and paragraph. for subsubsection change paragraph into subsubsection:

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
        {-3.25ex\@plus -1ex \@minus -.2ex}%
        {1.5ex \@plus .2ex}%
        {\normalfont\normalsize\bfseries}}
\makeatother

Space over/under Section/Subsection/...-Title

example for the article.cls. look at the specific class-files for section, subsection,... the definitions are always similar to this one of section. For a standard latex installation the class-files are stored in /usr/share/texmf/tex/latex/base/

in latex preamble

\makeatletter
\newlength{\mySpaceUnder}
\newlength{\mySpaceOver}
\setlength{\mySpaceUnder}{4cm plus .2ex}  % 4cm as an example ;-)
\setlength{\mySpaceOver}{3cm plus -1ex minus-.2ex}   % 3cm as an example
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {\mySpaceOver}%
                                   {\mySpaceUnder}%
                                   {\normalfont\Large\bfseries}}
\makeatother

use of package titlesec makes it just a little bit easier. It's part of the installed latex or available at CTAN for download. Maybe that it differs to the different classes, have a look at it.


Vertical Spacing

  • Line spacing
    • Package setspace from CTAN for individual spacing in a text, which is the best choice (read also http://www.tex.ac.uk/cgi-bin/texfaq2html?label=linespace)
      or
    • \renewcommand\baselinestretch{factor} (valid behind the next new fontsize)
      factor=1.0 is the document-wide chosen standard. Remember, that this is not the best choice for vertical linespacing!
  • Paragraph Spacing
    • \addtolength{\parskip}{-0.2cm} for changing the vertical space between paragraphs
    • \addtolength{\parskip}{+0.2cm} for changing to your old parskip
  • General Spacing
    • put the cursor in the last line (following space) or first line (before space) and do a \clearpage
      or
    • \vspace{length in any valid unit}, negative Space is possible!
      or
    • \vspace{\fill} for filling up the page with vertical space.
    • \vspace*{length in any valid unit} for vertical space at the beginning of a page.
  • local time: Wed Oct 16 21:14:38 CEST 2019 ; file is: 109.982962962963 days old
    contact webmaster _at_ TeXnik.de