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}
Please leave me a comment if you know of a simple and nice tutorial on how to install non-free-fonts like Arial. Thanks!
MiguelV
Excellent! Thanks a lot for your tips
Janssen
Do you really think someone asking for a document in Arial with 1 inch (2.54 cm) margins would be able to spot the differences between Arial and Helvetica?
tom
Thanks for your comment. Your are right, he certainly wouldn’t. My intention was to tell people there is a difference. I probably felt it’s not clean because the source I got the code from doesn’t mention it’s not Arial, but Helvetica. I should have provided that link before though.
Cheers, Tom.
Roel
Using XeLaTeX is a sort-of all powerful method to use any font you’d like and it works almost flawlessly. Why would you want to go through a lot of hassle – if it is at all possible – to convert a commercial font to be used with LaTeX?
Btw, blindtext is a nice change for using lipsum. Thanks for the suggestion 🙂
tom
Hi Roel, you are right, XeLaTeX is indeed very powerful and there is no reason for not using it in most cases. XeLaTex has some drawbacks (see the discussion on tex.SE. In the end, it’s up to the writer whether he can live with the drawbacks or prefers to stick to the standard fonts provided by TeX.
Yes,
blindtext
is great, I’ve been using it extensively, since I discovered it.Best, Tom
Lian Tze
Have you tried the winfonts package? http://ctan.org/tex-archive/fonts/winfonts
It’s not available in TeXLive nor MikTeX, so you’ll have to install it manually.
You’ll also have to tell LaTeX where to find arial.ttf etc, either by setting OSFONTDIR, or by copying the TTF files to somewhere like LOCALTEXMF/fonts/truetype/microsoft/ .
Then to use Arial as the default font:
tom
Hey, thanks for pointing this out. I will give it a try…
Best, Tom.
Humberto
Hi Tom,
In my output file I got an empty page, after the Appendix B. How I can delete this empty page?
Regards,
Humberto
tom
Hi Humberto,
Please provide a minimal example. With that, I will try to help you.
Thanks, Tom.
ricky
when i run on my latex with eclips (texlip) i got thet one “>><<" i dont know what it mean. but thx for "\blindtext". its new for me. n_nV
tom
Hi Ricky, please provide a minimal example that illustrates the problem. The code should be independent of the editor, texlipse is just an eclipse plugin. Thanks, Tom.
Humberto
Hi Tom the above minimal example is a simplified structure of my document. In the real document, a blank page is created at the beginning of the appendix, without a page number, and the next page contains the beggining of the appendix with the next page number. I just want to remove the blank page. .
I will appreciate any suggestion you can provide me.
Thanks,
Humberto
tom
Hey Humberto,
From your minimal example I can’t see the behavior you’re describing. It may be due to the fact that I didn’t have the
subrthesis1
package and can’t tell what it does. Have you tried not loading that particular package? Do you use thedocumentclass
optionstwoside
andopenright
?Please provide a minimal example that illustrates the issue.
Thanks, Tom.
Humberto
Hi Tom,
Below is the illustrative minimal example. I include part of the thesis style for our master program. I think the problem was caused when the student changed the command \baselinestrecht.
Thanks for any advise.
Humberto
——————————————-
[…]Code removed by Tom[…]
tom
Hi Humberto,
Sorry to remove your code and spoil your document, I removed the parts which were not necessary to illustrate the cause. As you can see from the code below (what is left from your document), the problem is caused by the stretch, as you already guessed. Actually, the appendix reaches into the margin, because
array
doesn’t add a page-break automatically. What I would suggest, if you can live with it, is to change thearraystretch
back to 1. The two commandsarraystretch
andbaselinestretch
add up to stretch what is already stretched. Here is the code that illustrates the problem. Try commenting outarraystretch
or set it to 1.2.Thanks for the example, it helped a lot. Let me know if you have any other questions. Best, Tom.
Humberto
Hi Tom,
Thanks so much for your advice. I changed back arraystretch to 1 and baselinestretch to 1.5. It works perfectly.
Thanks so much
Humberto
Jessie
This is very helpful, thanks!