Here is the preamble of my latex file:


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?

  • 3
    the overflow is only indirectly caused by your change of margins — it will be due to something after \begin{document} ... something that is preventing latex's natural line-breaking. since you give no indication of that, it may be impossible to determine what's wrong. Feb 18 '14 at 9:23
  • Can not reproduce. You should try to trim your document down to a minimal example still showing the same problem.
    – tobias_k
    Feb 18 '14 at 9:25
  • 2
    incidentally, you mention pdf output, but have \usepackage[dvips]{graphicx}; do you really run latex, then dvips, and then ps2pdf (or distiller)? if not, the [dvips] will make a mess of your output. (i don't think it will cause line breaking, but there may be something i’ve not thought of. Feb 18 '14 at 9:27
  • Have you heard of writelatex.com? You can test a minimal example independent of your local system. Test your code, iw works fine. There seems to be another reason.
    – Johannes_B
    Feb 18 '14 at 21:31
  • @wasteofspace,@tobias_k,@Johannes_B Thank you guys for the comment! I've just edited the codes, which can output an example for you. You'll see the text overflows at the right side of the page. Feb 18 '14 at 21:31

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.