# [texhax] textwidth question take two

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Tue Jun 3 09:17:24 CEST 2003

> I'm having some problems with the syntax of
> \setlength{\texdtwidth}{lengthcm} as documented in "A Guide to Latex",
> third edition by Kopka and Daly.
>
> If I enter
> \documentclass[12pt]{book}
> \begin{document}
> \noindent
> \hoffset=-.5in
> \large
> \setlength\textwidth=+18cm
>
> I get this error on compiling:

of course: look what the latex book said.  what you wrote was
equivalent to \setlength{\textwidth}{=}

> If I enter
> \documentclass[12pt]{book}
> \begin{document}
> \noindent
> \hoffset=-.5in
> \large
> \setlength{\textwidth}{18cm}
>
> I get no error messages on compiling but the text is not extended to the
> desired length.
>
> Changing \setlength{\textwidth}{18cm} to \setlength{\textwidth}{6 in}
> gives me the same results.  What is the correct literal way to define
> textwidth?

don't.  \textwidth is an internal length, and not what the underlying
tex engine reads to set the width: that's set in terms of \textwidth
and other things, before you get to it after the book class has been

since you're not acquainted with latex internals, i would strongly
suggest you use a package such as geometry to change the width of your
text: that gets the "other things" right, and everything falls into
place.  (the documentation of geometry is pretty comprehensive; if
you're using tetex, "texdoc geometry" will give you it; don't know
what other distributions have as an equivalent.)

Robin Fairbairns

UK TeX FAQ maintainer

http://www.tex.ac.uk/faq