Path: utzoo!attcan!uunet!samsung!usc!elroy.jpl.nasa.gov!jarthur!mimir.claremont.edu!dhosek From: dhosek@mimir.claremont.edu (Don Hosek) Newsgroups: comp.text.tex Subject: Re: Need non-fixed-width parbox in LaTeX Message-ID: <1990Dec11.094121.1@mimir.claremont.edu> Date: 11 Dec 90 17:41:21 GMT References: <1568@abekrd.UUCP> Sender: news@jarthur.Claremont.EDU Organization: Harvey Mudd College Lines: 28 In article <1568@abekrd.UUCP>, garyb@abekrd.UUCP (Gary Bartlett) writes: > I need to format a piece of text in a parbox (because I need to specify > where the line breaks are to occur) but I want the final box to be only as > wide as the largest line of text. I cannot figure out how to achieve this. > eg - the text to be formatted: > this is line 1 \\ > this is a longer line 2 \\ > the end > I will always specify where the line breaks are to occur so I don't need > LaTeX to split the lines for me. Theoretically therefore, I don't need to > specify a width. Unfortunately, \parbox demands a width. I don't know the > width of the longest line before hand either. Can anyone see a way around > this? \newenvironment{centerlongestline}{\begin{center}\begin{minipage}{\linewidth} \begin{tabbing}}{\end{tabbing}\end{minipage}\end{center}} See the LaTeX manual under the tabbing environment for an explanation of why this works. Another alternative would be to use \begin{tabular}{l} ... \end{tabular} rather than a tabbing environment, in which case the minipage environment could be omitted entirely. -dh