Graphics, Figures & Tables ⇒ Line break within a table cell
Line break within a table cell
I can't just use "\\" within a table cell, but I want to start a new line. What can I do to achieve this?
Last edited by ptrcao on Sun Apr 03, 2011 1:01 pm, edited 1 time in total.
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
Latex editor of choice: TexWorks (for dual view feature)
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Line break within a table cell
Get familiar with the features of a standard tabular environment. If your own efforts come to nothing, provide a minimal example that shows the problem(s) clearly. Emphasize is on minimal content. The example has to be compilable as provided.
Thorsten
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Line break within a table cell
In the below minimal example, I want to line break before the new sentence starting with "Presence of lactose...":localghost wrote:Get familiar with the features of a standard tabular environment. If your own efforts come to nothing, provide a minimal example that shows the problem(s) clearly [1]. Emphasize is on minimal content. The example has to be compilable as provided.
Thorsten
Code: Select all
\documentclass[12pt]{article}
\usepackage{fullpage}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
\begin{table}[h!]
\begin{tabularx}{1 \linewidth}{X X X X}
\toprule
Media & Characteristics & Uses/limitations \\
\cmidrule(r){1-1} \cmidrule(l r){2-2} \cmidrule(l){3-3}
MacConkey agar & The selective components in MAC are bile salts and crystal violet, which inhibit the growth of gram-positive bacteria. Presence of lactose and neutral red (a pH indicator) will confirm a gram-negative bacteria that uses lactose as a carbon and energy source. Release of acidic products changes colony colour to red. & Used as a form of selective and differential media to contrast types of gram-negative bacteria that use lactose vs. those that don't.\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
Latex editor of choice: TexWorks (for dual view feature)
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Line break within a table cell
Just begin a new paragraph at the appropriate place.
Code: Select all
… of gram-positive bacteria.\par Presence of lactose …
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Line break within a table cell
Great, that's progress. I still want an actual line skip between the paragraphs, I've tried \newline but that doesn't work. Do you know how I can get a line skip? Thanks.localghost wrote:Just begin a new paragraph at the appropriate place.Code: Select all
… of gram-positive bacteria.\par Presence of lactose …
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
Latex editor of choice: TexWorks (for dual view feature)
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Line break within a table cell
Then just insert a skip.
Code: Select all
… of gram-positive bacteria.\par\medskip Presence of lactose …
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Line break within a table cell
Thanks localghost. That's good. And just to reinforce the fact that this is a following, not a leading paragraph, is there a way to make it indent a little?localghost wrote:Then just insert a skip.Code: Select all
… of gram-positive bacteria.\par\medskip Presence of lactose …
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
Latex editor of choice: TexWorks (for dual view feature)
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Line break within a table cell
You should decide either for a skip or an indentation. A combination is typographical nonsense. But if you insist, just insert some additional horizontal space (\indent doesn't work here).
Code: Select all
… of gram-positive bacteria.\par\medskip\hspace*{3pt} Presence of lactose …
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Line break within a table cell
To revisit an old problem. Why can't the suggested solution work for this? Look out for the \par\medskip below (on the row starting with "MSA" and notice it does not achieve the desired new paragraph and lineskip. Thanks.
Code: Select all
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{figure*}
\small{
\begin{center}
\begin{tabular}{@{} l c c @{}}
\toprule
Characteristic & \multicolumn{2}{c}{Result}\\
\cmidrule{2-3}
& Seaweed isolate & Coral isolate \\
\midrule
Cell shape & Rod & Rod\\
Gram stain & $-$ & $-$\\
Oxidase & $+$ & $-$\\
Catalase & $+$ & $-$\\
Anaerobic & Growth (weak) & No growth\\
Motility & $+$ & $-$ or ? \\
Indole production & $+$ & $-$ or ? \\
Hugh \& Leifsons & ? & ? \\
MSA \par\medskip Growth \par\medskip Mannitol utilisation & Growth & No growth\\
%Growth in absence of salt & & \\ (Didn't get time to do this one.)
Colony pigmentation & White & White \\
Colony texture & Smooth, creamy & Waxy, pellet-like \\
Colony edges & Entire & Entire \\
Colony shape & Round & Round \\
Colony elevation & Flat & Buldge\\
Medium modifications & Cracked patterns & Clear halo, pits, liquification\\
\bottomrule
\end{tabular}
\end{center}
}
\end{figure*}
\end{document}
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
Latex editor of choice: TexWorks (for dual view feature)
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Line break within a table cell
The chosen column types don't allow line breaks or paragraphs, respectively.ptrcao wrote:[…] Why can't the suggested solution work for this? […]
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10