Graphics, Figures & Tables ⇒ newline in tables
newline in tables
the row to a new line. According to the documentation, it says to
insert TeX command
\linebreak
I did that and saw no result in the pdf or DVI
I also read that you can do
\newline
I got nothing on that as well.
Am I doing something wrong?
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
newline in tables
Please give a link to the documentation that told you so. Show us the concerning table by means of a minimal working example (MWE) and explain exactly what you want to achieve.jlillywh wrote:[...] According to the documentation, it says to insert TeX command
\linebreak [...]
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
newline in tables
http://wiki.lyx.org/LyX/Tables#toc4
under the heading 'multiple lines in one cell'
below is my sample file where I can't get \linebreak to work:
Code: Select all
%% LyX 1.6.3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\makeatother
\usepackage{babel}
\begin{document}
Here is a table where the \textbackslash{}linebreak is not working.
It should start a new line after the word {}``jumps.''
%
\begin{table}[h]
\caption{my table}
\begin{tabular}{|c|c|}
\hline
x & y\tabularnewline
\hline
\hline
the brown cow jumps\linebreak over the moon & the dog barks\tabularnewline
\hline
stuff & stuff\tabularnewline
\hline
\end{tabular}
\end{table}
\end{document}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
newline in tables
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 1
- Joined: Sun Jun 21, 2009 6:12 pm
Re: newline in tables
To do this in LyX, click the Insert TeX Code button then write either \parbox{<width>}{<Text goes here>} or \begin{minipage}{<width>}<text goes here>\end{minipage}.
Widths are standard latex stuff e.g. 1in for one inch, 1cm for 1 cm and so on (or you could use the units ex or em to get widths that vary according to the current font size).
EDIT: Oh, I forgot to mention one thing, this way of getting linebreaks inside a cell tend to cause the space between the stuff in the parbox/minipage and the rows above and beneath to be a bit too small. In a "normal" latex editor I'd just add a bit of extra space to the linebreaks between table rows but I don't know if that's possible in LyX. A possible workaround is to put a strut at the beginning of the text in the parbox/minipage with e.g. \rule{0pt}{1.1\baselineskip} and a bit of space at the end with e.g. \vspace{1ex}.