From: carlisle@cs.man.ac.uk (David Carlisle)
Newsgroups: comp.text.tex
Subject: Re: \raggedright paragraph in tabular environment
Date: 19 Aug 92 14:11:11 GMT
Organization: Department of Computer Science, University of Manchester
In-reply-to: zahilb@pbhrzt.uni-paderborn.de's message of 19 Aug 92 09:26:16 GMT

>>>>> On 19 Aug 92 09:26:16 GMT, zahilb@pbhrzt.uni-paderborn.de (Erhard Hilbig) said:

Erhard> I want to get a raggedright paragraph in a tabular environment without any
Erhard> extra lines above or below. (see the following example)

......

Erhard> \newcommand{\rra}[1]{{\raggedright #1}}
Erhard> %this command does not work at all!!!

Erhard> \newcommand{\rrb}[1]{{\raggedright #1 \par}}
Erhard> %this produces an extra line after the paragraph!!!

The first command does not work, or more exactly it will not make the
last paragraph in each entry raggedright. This is because the
paragraph is set according to the values of certain parameters at the
END of the paragraph. In the first example the closing } restores all
these parametrs before the last paragraph finishes.

I think that you knew this, which was why you added the \par in the
second try. Unfortunately this has a bad interaction with LaTeX's
attempt to maintain a consistent depth for each row. It trys to add a
strut to the last line, but if you end with \par, this strut ends up
creating extra white space.

If you are not in the last column, you can just use \raggedright,
without any extra braces, however \raggedright redefines \\, so you
can not use it in the last column unless you preserve the tabular
definition of \\.

So your example file works fine if you go:

\documentstyle{article}

\newcommand{\rra}[1]{\let\temp=\\\raggedright#1\let\\=\temp}
\let\rrb\rra

\begin{document}

\footnotesize

\begin{tabular}{|p{3cm}|p{7.5cm}|}
\hline
\bf Chemische Hauptgruppe&\rra{\bf Chemikalien innerhalb der jeweiligen
Hauptgruppe}\\
\hline
Kohlenwasserstoffe&\rra{Benzol, Toluol, Xylol, Cyclohexan, leichte
	Kohlenwasserstoffe, Petroleum, Schwerbenzine, Lackbenzin}\\
\hline
Alkohole&\rra{Isopropanol, Glykol, Glyzerin}\\
\hline
Halogenide&\rrb{S\"amtliche organischen Monohalogenide,\\
	z.~B. Amylbromid, Butylbromid, Butylchlorid, Cyclohexylbromid,
	Ethylbromid, Propylbromid, Propylchlorid, Trimethylbromid,
	Brombenzol, Chlorbenzol, Tetrachlorkohlenstoff und sonstige
	aromatische Halogenide}\\
\hline
Nitrile (Cyanide)&\rrb{Diphenylacetonitril (Diphenylmethylcyanid)}\\
\hline
Ester&\rrb{Allyi-Butyrat, -Caproat, -Formiat und -Propionat,\\
	Amyl-Butyrat, -Isobutyrat, -Caproat und -Caprylat,\\
	Benzyl-Butyrat, -Isobutyrat, -Propionat und -Succinat,\\
	Butyl-Butyrat, -Isobutyrat, -Caproat, -Propionat, -Succinat,\\
	Isobutyl-Benzoat, -Butyrat und -Caproat,\\
	Cyclohexyl-Butyrat, Ethyl-Butyrat, -Isobutyrat, -Caproat,
	-Caprylat, -Propionat und -Succinat,\\
	Methyl-Butyrat, -Caproat, -Propionat und -Succinat,\\
	Octyl-Butyrat und -Caproat,\\
	Propyl-Butyrat, -Isobutyrat, -Caproat, -Formiat und -Propionat,\\
	Isoprypyl-Benzoat, -Caproat und -Formiat}\\
\hline
Phenole&\rrb{Phenol, Kresole (Methylphenole), Xylenole
	(Dimethylphenole), Biphenol (Dihydroxyphenol),
	2,4-Dichlorphenol, Parachlorkresol und Chlorxylenole}\\
\hline
\rrb{Aromatische Amine und Aminsalze}
       &\rrb{Pyridin, Pyrrolidin, Methylpiperazin, 2:4 Diamino
	5- (Chlorphenyl-) 6-Ethylpurimidin, Hydroxyethylmorpholin
	(Hydroxyethylenimid-Oxid), Para-Aminobenzol, Sulfonylguanidin,
	Dicarbathoxypiperazin, 1-Benzhydryl 4-Methylpiperazin,
	Butylaminoleat, Piperazin-Hydrochlorid-Monohydrat und
	Carbathhoxypipetrazin-Hydrochlorid (trocken)}\\
\hline
Amide	&\rrb{Formamid und Dimethylformamid}\\
\hline
Sonstiges &\rrb{Traubenzucker (fl\"ussig), Benzilidenaceton,
	Para-Chlorbenzophenon, Natrium-Azobenzolsulfonat,
	Dimethylthianthren (Dimethyldiphenylen-Disulfid),
	Metaninharzlsungen, Polyesterharzlsungen und roher
	Cascarwurzelextrakt}\\
\hline
\end{tabular}

\end{document}

--
                           David Carlisle
                                    JANET: carlisle@uk.ac.man.cs

                                    Computer Science Department
                                    Manchester University
                                    Oxford Road
                                    Manchester
                                    England
                                    M13 9PL