[Tex/LaTex] Why Latex does not start a new line automatically

line-breakingpackages

Here is the preamble of my latex file:

\documentclass{article}
\usepackage[margin=.5cm]{geometry}
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}

My problem is the text in the document won't be started in a new line in the generated PDF file and just overflow out of the page. I find this is caused by my personal definition for margin of 0.5cm by using the geometry package. Is there any solution for this while we still use the geometry package?

Best Answer

As the solution --- being explicit about the paper size --- suggests, it is likely there is a disconnect somewhere regarding the actual paper size ('letterpaper' vs 'a4paper'). The package geometry usually guesses well, but if it can't figure it out, it defaults to the dvips driver, which may have different defaults from what you are actually using.

Adding the a4paper option helps clear up any confusion, but if you want to explore your system defaults, there are a few options.

An old classic is to do

latex testpage.tex # or pdflatex testpage.tex

and follow the prompts. It will output a document that shows clearly whether your defaults are what you think they are. If I use a4paper on my computer, which is set up to use letterpaper by default, it is quite clear that the typeblock is positioned incorrectly.

If you use a TeX Live that includes tlmgr (i.e., not one installed from your OS's repositories), then it is easy to check and also change what your paper defaults are.

tlmgr paper

will list the default paper size for all drivers (ConTeXt, dvipdfmx, dvips, pdftex, xdvi). If you don't like what you can see, then you can do

tlmgr paper a4  # or: tlmgr paper letter

This will change the default for all known drivers to a4paper (or letterpaper). In the unlikely case that you'd like to exercise finer-grained control, you could do something like

tlmgr dvips paper a4

to set a specific driver.