Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!uunet!mcsun!unido!laura!tommy!klute From: klute@tommy.informatik.uni-dortmund.de (Rainer Klute) Newsgroups: comp.text.tex Subject: Re: Need non-fixed-width parbox in LaTeX Message-ID: <2855@laura.UUCP> Date: 12 Dec 90 08:34:34 GMT Sender: news@laura.UUCP Reply-To: klute@tommy.informatik.uni-dortmund.de (Rainer Klute) Organization: University of Dortmund, Germany Lines: 32 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 Not really a solution, but an ugly hack that works: \newlength{\longestline} \settowidth{\longestline}{this is a longer line 2} \parbox{\longestline}{ this is line 1 \\ this is a longer line 2 \\ the end } The problem is that you have to find out which of your line is the longest one and then paste it into the \settowidth command. This task must be carried out by running latex at least once over your document. If someone has a better idea please let me know! -- Dipl.-Inform. Rainer Klute klute@irb.informatik.uni-dortmund.de Univ. Dortmund, IRB klute@unido.uucp, klute@unido.bitnet Postfach 500500 |)|/ Tel.: +49 231 755-4663 D-4600 Dortmund 50 |\|\ Fax : +49 231 755-2386