About these ads

Tag Archives: onehalfspacing

Latex page, line and font settings

I was recently asked to write a three page assignment/case study using the following page, line and font settings:

  • Arial, size 12
  • 1.5 line spacing
  • 2.5cm margin all round

Let’s do one by one.

 

Font type and size

Font types are actually a bit of a pain in Latex and so far, I have almost always been using the standard font, Knuth’s Computer Modern. The reason for not using the fonts provided by the system is that Tex and Latex will give the same distinctive look no matter which platform a document was compile on, making the language system independent.

Some fonts are available, including Times Roman, Helvetica and Courier. Arial however is a “non-free-font” from Microsoft and has to be installed manually — I give up, it’s getting late and I tried various things without success, including installation of the Arial font family.

I will go with XeLaTeX using system fonts, nice :-) .

\documentclass[11pt]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
\blindtext
\end{document}

Another, less clean approach I came across uses Latex with the following two lines added to the preamble:

\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}

It changes the font family to Helvetica, which is very similar to Arial, but it’s not the same.

The font size is easy, just use the documentclass option:

\documentclass[12pt]{article}

This brings me to the next point on the list above. I will stick to XeLaTeX, but all the examples will perfectly work with LaTeX, assuming you are using Helvetica and not Arial.

 

Linespacing

Basically, 1.5 line spacing is done using the setspace package as follows:

\usepackage{setspace}
\onehalfspacing

Please see my previous post on that topic for more details on line spacing.

 

Setting the margins

If you are lucky enough to require an equal margin on all sides, the geometry package with the margin option will do the trick:

\usepackage[margin=2.5cm]{geometry}

For different margins on every side, the package provides four options: top, left, bottom, right:

\usepackage[top=1.2in, left=0.9in, bottom=1.2in, right=0.9in]{geometry}

See the package documentation for more details.

 

Complete example (XeLaTeX)

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage{blindtext, fontspec, setspace}
\usepackage[margin=2.5cm]{geometry}
\setmainfont{Arial}
\onehalfspacing
\begin{document}
\blindtext
\end{document}

Customizing font, margins and line spacing.

Please leave me a comment if you know of a simple and nice tutorial on how to install non-free-fonts like Arial. Thanks!

About these ads

Quick note on line spacing

There are two different ways to change line spacing in LaTeX. One is simpler, the other requires a package, but is more flexible.

Let’s start easy.

The linespread-command:

To change the line spacing for the entire document, you can use the linespread command in your preamble:

\linespread{<factor>}

The factor is somewhat confusing. For double-spacing you have to use 1.6 and for one-and-a-half spacing 1.3. Not very intuitive, but I'm sure there is a reason for it.

The setspace-package:

Personally, I prefer the setspace package, which is more straight forward in usage, provides more flexibility and is easy to use as well:

\usepackage{setspace}
\singlespacing
\onehalfspacing
\doublespacing
\setstretch{<factor>} % for custom spacing

You can change spacing back and forth within your document using the commands above.
However, in order to stay on top of things, it's usually better using an environment to change vertical spacing locally.

\begin{doublespace}
...
\end{doublespace}

or

\begin{spacing}{2.0}
...
\end{spacing}

Finally, the package provides improved vertical spacing on top and below of itemize and quote environments, for any other than single-space content:

\usepackage{setspace}
\doublespacing
...
\begin{singlespace*}
\begin{quote}
Quote
\end{quote}
\end{singlespace*}

And that's the difference:

Single space quote with default vertical spacing

Default vertical spacing

Single space quote with improved vertical spacing

Improved vertical spacing

The package is documented within the style-file


Follow

Get every new post delivered to your Inbox.

Join 709 other followers

%d bloggers like this: