The three lengths \textwidth, \linewidth and \hsize seem to all hold the width of the current line. At least I never saw some real difference between \textwidth and \linewidth in my code. Both seem to be identical even when changed, e.g. by a minipage environment.

Could someone give me an elaborate explanation of the differences between these lengths? I like to understand them in detail. I know that the first two are from LaTeX and the latter one from plainTeX.

There is also \columnwidth which seems to be identical to \linewidth or \textwidth in one-column mode, right? Except when the line is reduced by a minipage or quote etc. environment.


\hsize is the main parameter that TeX uses when typesetting: whenever it finishes a paragraph it looks at the current value of \hsize for breaking it into horizontal boxes. Next, there are \leftskip and \rightskip and possibly other paragraph shape parameters (\hangindent and \hangafter or the more general \parshape).

LaTeX uses an indirect approach and maintains many \...width parameters.

\textwidth is generally the global width of the text area, while \columnwidth is the width of a column of text (it will be different from \textwidth when typesetting in two or more columns). However, inside a minipage, \textwidth will be set to the given argument along with \hsize, \columnwidth, and \linewidth (they will revert to the previous values at the end of the minipage because it forms a group). Note that \parbox doesn't reset \textwidth; the size is available as \linewidth.

The parameter \linewidth contains the line length inside a list (or derived) environment and it may change in a nested list (while \hsize, \textwidth and \columnwidth don't change).

When we have to specify a length depending on current conditions, we have to use the correct parameter. For example, the width of a figure should be specified in terms of \columnwidth in a figure environment and of \textwidth in a figure* environment; however this is done rarely when it's known that the document will be typeset in one column format. The same should be for a tabular* or tabularx environment.

Instead, when we need something centered with respect to a line in a list, we should use \linewidth:

\item some text that contains a `here' table
      and some other text that follows.
\item ...

In this case it would be wrong to use \textwidth or \columnwidth, as the line length is "unknown" at typing time.

Notice that LaTeX uses \hangindent only for typesetting sectional titles and \leftskip and rightskip for \centering, \raggedright and \raggedleft; the indentation of a list environment is obtained via \parshape.

  • 1
    Couldn't the general advice for the width of the figure be to always use \linewidth? – Will Robertson May 1 '11 at 3:08
  • 3
    I.e., the way that I think about it is that \linewidth is the most general of the lot, adapting to its current situation, whereas \textwidth and \columnwidth are fixed design-oriented lengths. (And \hsize should be avoided in LaTeX, generally speaking.) – Will Robertson May 1 '11 at 12:45
  • 5
    @Will: there's the problem that we don't know a priori the value of \linewidth that will be used. For example, writing a \begin{figure}[h] environment in the middle of a list and using \linewidth will probably give a surprise. – egreg May 1 '11 at 13:10
  • 1
    @Will: I am actually putting figures (from standalone files) within an enumerated list. The same figure is used in different contexts and in one they happen to be part of a list. – Peter Grill May 17 '11 at 5:57
  • 1
    @Martin: this is the correct way. Exchanging the first two tokens is quite the same (if \par is primitive \par), while exchanging the last two is disastrous. – egreg Jul 8 '11 at 17:16

I think the simplest way to describe the difference is as follows:

  • \hsize is a TeX primitive that should not be usually used in LaTeX
  • \textwidth is the (constant) width of the total text block
  • \columnwidth is the (constant) width of a single column of text
    (which is the same as \textwidth for a single column document)
  • \linewidth is a variable that represents the current size of the line of text, whether inside a column or a minipage or a list

In general, then, it's best to always use \linewidth if you are specifying the relative size of an image or a box, since it will adapt to the current situation.

Note: \linewidth also appears to work in table columns, not just text columns. See this answer for an example where a fixed-width parbox is used within a table cell (actually a multirow cell).


A test document in a twocolumn and onecolumnmode:



\item \rule{\textwidth}{5pt}
\item \rule{\linewidth}{5pt}
\item \rule{\hsize}{5pt}
\item \rule{\columnwidth}{5pt}


\item \rule{\textwidth}{5pt}
\item \rule{\linewidth}{5pt}
\item \rule{\hsize}{5pt}
\item \rule{\columnwidth}{5pt}


enter image description here

  • 13
    Thanks Herbert, but it would be really nice to have some general explanation for this lengths, for one- and two-column mode. – Martin Scharrer Apr 29 '11 at 16:34

One difference is that in list and trivlist environments (i.e., including quote, quotation, and other such environments), \linewidth is smaller than \textwidth by the sum of \leftmargin and \rightmargin. I think I also remember that \hsize is what's used by the routine that breaks paragraphs into lines; since \leftmargin in a list is created by using the \parshape command, that routine doesn't need to be explicitly told about \leftmargin.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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