Graphics, Figures & Tables ⇒ Line break within a table cell
Line break within a table cell
Latex editor of choice: TexWorks (for dual view feature)
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Line break within a table cell
Thorsten
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}
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
Code: Select all
… of gram-positive bacteria.\par Presence of lactose …
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 …
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
Code: Select all
… of gram-positive bacteria.\par\medskip Presence of lactose …
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 …
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
Code: Select all
… of gram-positive bacteria.\par\medskip\hspace*{3pt} Presence of lactose …
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Line break within a table cell
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}
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? […]
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10