914

I have some text in a table and I want to add a forced line break. I want to insert a forced line break without having to specify the column width, i.e. something like the following:

\begin{tabular}{|c|c|c|}
\hline
Foo bar & Foo <forced line break here> bar & Foo bar \\
\hline
\end{tabular}

I know that \\ inserts a line break in most cases, but here it starts a new table row instead.


A similar question was asked before: How to break a line in a table

0

23 Answers 23

736

Use the makecell package. This package provides commands for formatting cells, including \thead (for header cells) and \makecell (for regular cells). For instance, to create a cell containing line breaks:

\makecell{Some really \\ longer text}

Additionally, the horizontal and vertical alignments can be chosen independently from those of the table they're included in. The default is cc, but you can change it globally in the preamble with

\renewcommand{\cellalign}{vh}
\renewcommand{\theadalign}{vh}

where v is one of t, c, or b and h one of l, c, or r. Alternatively, for a single cell, you can use the \makecell or \thead commands with the optional argument [vh].


Demo:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier} 
\usepackage{array}
\usepackage{makecell}

\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}

\begin{document}

  \begin{center}
    \begin{tabular}{ | c | c | c |}
      \hline
      \thead{A Head} & \thead{A Second \\ Head} & \thead{A Third \\ Head} \\
      \hline
      Some text &  \makecell{Some really \\ longer text}  & Text text text  \\
      \hline
    \end{tabular}
  \end{center}

\end{document} 

Compiled MWE

24
  • 101
    This is great, it works without specifying a width and does not need confusing hacks. Maybe worth to mention that the example here contains much more than is actually necessary to answer the question: just adding \usepackage{makecell} and using \makecell{...\\...} is sufficient to get a linebreak in the cell.
    – luator
    Commented May 11, 2015 at 9:48
  • 3
    Is it me or the \thead command actually decreases the font size of the cell?
    – Dr_Zaszuś
    Commented Aug 2, 2017 at 14:03
  • 3
    @Dr_Zaszuś, no it is not you. makecell defaults thead to footnotesize. If you want something else, you can redefine it globally or locally with, e.g. \renewcommand\theadfont{\normalsize}.
    – gusbrs
    Commented Dec 21, 2017 at 16:43
  • 28
    As explained, if it's for all you document, \renewcommand{\cellalign}{l} (it will remain vertically centred), or, for some specific cells, makecell[l]{ ... } or \thead[l]{ ... }.
    – Bernard
    Commented Feb 26, 2018 at 13:04
  • 4
    As explained, it is by default vertically and horizontally centred. But you can change that either redefining \cellalign in the preamble, so it's valid for the whole document, or using an optional argument, such as \makecell[l] { ... \\ ... } to have all lines left-aligned, for instance.
    – Bernard
    Commented Nov 4, 2018 at 2:32
459

It's a quite old question, but I'll add my answer anyway, as the method I suggest didn't appear in the others

\begin{tabular}{|c|c|c|}
\hline
Foo bar & \begin{tabular}[x]{@{}c@{}}Foo\\bar\end{tabular} & Foo bar \\
\hline
\end{tabular}

where x is either t, c, or b to force the desired vertical alignment.

In case this is needed in more than a couple of places, it's better to define a command

\newcommand{\specialcell}[2][c]{%
  \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}

so the table line before can be one of

Foo bar & \specialcell{Foo\\bar} & Foo bar \\    % vertically centered
Foo bar & \specialcell[t]{Foo\\bar} & Foo bar \\ % aligned with top rule
Foo bar & \specialcell[b]{Foo\\bar} & Foo bar \\ % aligned with bottom rule

More variations are possible, for instance specifying also the horizontal alignment in the special cell.

Notice the @{} to suppress added space before and after the cell text.

23
  • 31
    For those wanting to control the horizontal alignment, change c@ to l@ or r@ (or make it another parameter like the vertical alignment?). Thanks egreg Commented Apr 19, 2012 at 13:31
  • 11
    \parbox will do the same, but you have set a width: \parbox[t]{5cm}{foo\\bar}
    – Born2Smile
    Commented Dec 8, 2012 at 14:11
  • 2
    @Born2Smile There's the varwidth environment (package of the same name), but it's overkill.
    – egreg
    Commented Dec 8, 2012 at 14:15
  • 24
    This wins the prize for the most incomprehensible answer. Commented Jan 13, 2014 at 13:00
  • 14
    Egreg's solution is one of the most interesting and efficient I ever seen for line breaking at tables! Thanks. However, I made a slight change to specify the alignment directly from the command \specialcell: \newcommand{\specialcell}[3][c]{% \begin{tabular}[#1]{@{}#2@{}}#3\end{tabular}}% which should be called by \specialcell{<align>}{text1\\text2} where <align> must be replaced by the desired position: l (left), c (center), r (right). Despite this mod, all credits to @egreg. Commented Apr 13, 2015 at 0:40
273

You can switch your cell layout to paragraph to use the \newline command.

\begin{tabular}{|p{2cm}|p{2cm}|}
\hline
Test & foo \newline bar \\
...

Edit:

Use the following commands instead of p if you want to specify the alignment as well:

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
7
  • 20
    I did. I tried both \newline and \linebreak, but they only work in paragraph mode. cims.nyu.edu/cgi-comment/info2html?(latex)%5Cnewline Commented Aug 28, 2010 at 0:56
  • 3
    @frabjous: Could you clarify the status of this answer? Does it work, and if so, how? (A complete MWE would be good.)
    – doncherry
    Commented Jun 9, 2012 at 15:06
  • 55
    @doncherry: This answer works, iff your column type is p{width} or X (in a tabularx environment). It does not work with c, l or r columns, as requested by the asker, though.
    – Fritz
    Commented Aug 28, 2012 at 13:11
  • 2
    +1 This solution (unlike some others I've tried) also works well with \rowcolors
    – Dana
    Commented Mar 12, 2014 at 17:26
  • 3
    @doncherry I added a work around which will allow you to specify the alignment as well.
    – Matthias
    Commented Jan 26, 2017 at 13:24
234

You can use this:

\usepackage{pbox}

\begin{tabular}{|l|l|} \hline
    \pbox{20cm}{This is the first \\ cell} & second \\ \hline
    3rd & and the last cell \\ \hline
\end{tabular}

which looks like:

split cell with pbox

Note that the width supplied to \pbox is a maximum width. If the content is shorter the length of the longest line is taken.

10
  • 28
    This may be an obvious question. What is the 20cm for, and is there a way to remove it? (automatically choose the correct value)
    – AnnanFay
    Commented Dec 2, 2013 at 4:38
  • 1
    The \pbox solution is great. Alignment might be a bit tricky. If you run into trouble using this solution, see here tex.stackexchange.com/a/55861/13450
    – Christian
    Commented Apr 8, 2014 at 17:23
  • 2
    How to center the new line?
    – CroCo
    Commented Sep 19, 2014 at 14:22
  • 3
    Well, it’s still overly complicated because it’s a fixed width, but on the other hand I don’t want to be Mr Complainy Pants.
    – Lenar Hoyt
    Commented Dec 18, 2014 at 20:00
  • 1
    I extend this solution in my code by \newcommand{\multilinebox}[1]{\pbox{\linewidth}{\vspace{.5\baselineskip}#1\vspace{.5\baselineskip}}} in order to have proper spacing between the previous and next rows. Commented Feb 28, 2017 at 16:34
164

Use the tabularx environment instead of tabular, and then use \newline where you want line breaks within a cell.

\usepackage{tabularx}
\begin{tabularx}{\textwidth}{lX}
    Section:   &  This is my     \newline
                  long paragraph \\
\end{tabularx}

The tabularx environment has a special column type, X, in addition to the usual ones, and its first argument is the desired width of the table. The X column will have the necessary width in order to make the whole table the desired width.

Note: \newline will not take effect in columns of standard type.

Details on tabularx can be found here.

7
  • Nice one, I hadn't realised tabularx supported this, thanks for mentioning it.
    – Bruce
    Commented Feb 23, 2012 at 4:02
  • 3
    By far the easiest solution!
    – mtsz
    Commented Oct 9, 2012 at 21:33
  • How does this work? I'm not getting the desired output.
    – CroCo
    Commented Mar 28, 2015 at 1:56
  • 7
    @carandraug, note that the question asks specifically for a forced line break, so the explicit \newline is not pointless.
    – Will
    Commented Jan 14, 2016 at 17:19
  • 2
    Note: \newline will not take effect in columns of standard type. So how to make \newline to take effect on a column of a standard type?
    – Aryo
    Commented Jul 27, 2020 at 0:20
86

Here's a very simple way to do it, using Plain TeX commands within the tabular environment:

\begin{tabular}{|c|c|c|}
\hline
here&\vtop{\hbox{\strut top line}\hbox{\strut botline}}&more\\
\hline
x&y&z\\
\hline
\end{tabular}

table produced with code above

By using hboxes within the vtop we've stayed in vertical mode and therefore the width of the text in the hboxes determines the width of the vtop. This way we don't need to know the width of the text in advance. \strut will maintain the right space above and below the text in the hbox.

5
  • 1
    Hi Amy, and welcome to TeX.sx. You might want to read Welcome to TeX.SX! and note that signing your posts is not necessary since your name appears at the bottom automatically. See also Rules about linking to external pages. With respect to this particular answer, how is it different from TH's answer?
    – Alan Munn
    Commented Sep 10, 2013 at 20:08
  • 5
    Thank you! This works when you are in a multicell but they are left aligned (even through I defined it to be in the centre). Is there a way around this? Commented May 14, 2014 at 16:41
  • The nice thing about this answer is that \vtop{\hbox{\strut top line}\hbox{\strut botline}} can be used within Pandoc Markdown tables. Commented Oct 21, 2014 at 11:11
  • @SergeStroobandt not only that. It can be used everywhere! (because is TeX) I just needed some line break in \text of \alignat environment and worked perfectly. Thanks for this robust and simple answer! Commented Jan 4, 2016 at 11:07
  • 1
    Definitely the best answer on this page ! Commented Feb 26, 2019 at 11:09
45
\begin{tabular}{lll}
a&\vbox{\hbox{\strut ASDF}\hbox{\strut ASDF}\hbox{\strut This is my
really long line}}&c
\end{tabular}

The \strut is essential for spacing.

6
  • This looks like good method. Maybe too much to ask, but is there any easy way to adjust vertical justification in the cells? E.g., so single line cells are even with top of multi-line cell? Or so all are vertically centered? Commented Aug 28, 2010 at 15:33
  • 3
    Replace \vbox with \vtop to get alignment at the top.
    – TH.
    Commented Aug 29, 2010 at 0:49
  • 2
    Great answer. How do you center horizontally?
    – denilw
    Commented Oct 21, 2010 at 20:47
  • 1
    @denilw: Oops. I misread and wrote a previous comment (now deleted). If you want to center the lines, the easiest way is to compute the width of the widest \hbox and use that as the width of the other \hboxes. Something like \vbox{\setbox0\hbox{\strut This is the widest one.}\hbox to\wd0{\hss\strut ASDF\hss}\copy0\hbox to\wd0{\hss\strut asdf\hss}}
    – TH.
    Commented Oct 21, 2010 at 21:05
  • 1
    Why is "ASDF" used for the strut?
    – einpoklum
    Commented Feb 25, 2017 at 13:54
44

You can also just fake it:

\begin{tabular}{|c|c|c|}
\hline
Foo bar & Foo & Foo bar \\
~       & bar &  ~      \\
\hline
\end{tabular}
32

Here I use stacks to accomplish it. Several things are noteworthy:

  1. I demonstrate \Longstack , \Longunderstack and \Centerstack, which give three different alignments.

  2. In order not to squeeze against the vertical margins, a \strutlongstacks{T} declaration was issued. Alternately, one might wrap a stack inside an \addstackgap[<gap>]{content} to add a vertical buffer above/below the stack.

  3. Not shown is the ability to set the horizontal alignment of the stacked content with an optional argument, or to change the EOL character (from \\ to another user-specified token)

Here is the MWE.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\begin{document}
\strutlongstacks{T}
\begin{tabular}{|c|c|c|}
\hline
Foo bar & \Longstack{ Foo \\ bar \\ baz} & Foo bar \\
\hline
Foo bar & \Longunderstack{ Foo \\ bar \\ baz} & Foo bar \\
\hline
Foo bar & \Centerstack{ Foo \\ bar} & Foo bar \\
\hline
\end{tabular}
\end{document}

enter image description here

5
  • 1
    This is gorgeous! I'm wondering why it has so few votes...
    – CarLaTeX
    Commented Apr 28, 2017 at 7:39
  • 1
    @CarLaTeX Thanks for the kind words. I think that I give so many answers with stacks, people are of the opinion, "you seen one, you seen 'em all." I am a victim of my own success. Commented Apr 28, 2017 at 9:52
  • It's really a pity that people stop at the first answers! :)
    – CarLaTeX
    Commented Apr 28, 2017 at 10:36
  • This really helped me and this is so simple to use! Commented Apr 15, 2021 at 10:54
  • 1
    @ShahadMahmud I'm happy that you find the package useful. Commented Apr 15, 2021 at 11:30
18

This is a really old question, but since this was linked from a recent question on separating content and presentation, I'll add a ConTeXt answer for comparision.

In ConTeXt, \crlf adds a forced line-break, so achieving a forced line-break in a table is as simple as just adding \crlf in the appropriate place. Here is the complete example:

% Setup for rules at the top and bottom
\startsetups table:rules
  \setupTABLE[frame=off]
  \setupTABLE[row][first][topframe=on]
  \setupTABLE[row][last][bottomframe=on]
\stopsetups

% Setups for middle alignment
\startsetups table:middle
  \setupTABLE[align=middle]
\stopsetups

\starttext

\startTABLE[setups={table:rules, table:middle}]
  \NC Foo bar \NC Foo \crlf Bar \NC Foo bar \NC \NR
  \NC Foo bar \NC Foo \crlf Bar \NC Foo bar \NC \NR
\stopTABLE

\stoptext

which gives:

enter image description here

4
  • 1
    your source code does not match what the illustration shows. Commented Nov 17, 2013 at 13:28
  • @KurtPfeifle: It does for me! Which version of context are you using?
    – Aditya
    Commented Nov 17, 2013 at 20:34
  • Sorry, didn't see your question earlier. My context is v. 0.60 (2013.04.20 01:15). However, now re-testing your code, I can confirm that your code works. I have to withdraw my previous statement. Can't remember now what caused me to make it. Commented Feb 11, 2014 at 19:30
  • As usual, ConTeXt is easiest with its \crlf (carriage return linefeed) command. Commented Oct 21, 2014 at 12:28
14

I believe I have the simplest answer here:

If you are using a paragraph column in a table, you can put text in an alignment environment and the table does not pick up the \\ as a new table row, so you can use it normally. For example:

\begin{tabular}{p{2in}p{2in}}
    \begin{flushleft}
        Some text over here \\ 
        newline! \\ 
        \bigskip all the way down 
    \end{flushleft} 
    & 
    \begin{flushleft}
        Lorem ipsum dolor sit amet, consectetur 
        adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore 
        magna aliqua. Ut enim ad minim veniam,
        quis nostrud exercitation ullamco laboris 
        nisi ut aliquip ex ea commodo\\ \bigskip
        consequat. Duis aute irure dolor in 
        reprehenderit in voluptate velit esse
        cillum dolore eu fugiat nulla pariatur. 
        Excepteur sint occaecat cupidatat non
        proident, sunt in culpa qui officia 
        deserunt mollit anim id est laborum.\\ 
        \bigskip \bigskip lorem ipsum\\
    \end{flushleft}\\
\end{tabular}\

Will give you a table with line breaks using the \\ command.

1
  • 6
    I think the explanation is wrong - I just tried {flushleft} in a l column, and it fails; I think the reason why this example works is because it has p{2in} column type, which sets the width in advance..
    – sdaau
    Commented Jul 10, 2014 at 1:08
14

How about using \parbox in a custom command:

\documentclass{article}
\newsavebox\mybox
\newlength\mylength
\newcommand\boxup[2]{%
  \savebox\mybox{#1}%
  \setlength\mylength{\wd\mybox}%
  \parbox{\mylength}{#1 \\ #2}%
}
\begin{document}
\begin{tabular}{|c|c|c|}
Foo bar & \boxup{Foo}{bar} & Foo bar \\
\end{tabular}
\end{document}

This takes two arguments with the assumption that the first line is longer than the second. It would be possible to refine the code to work through an arbitrary number of lines and find the longest. If that's of interest I'll write something, probably using expl3 for the looping.

1
  • Gives me issues with too little vertical spacing. \vspace only helps for the bottom margin. Commented Oct 23, 2011 at 22:09
13

I think multirow is a simple elegant solution, at least for simple tables.

For example, I tried a few of the suggestions above but I found this worked the best:

\usepackage{multirow}
\begin{table}[ht]
    \caption{RESTful Resources}
    \centering
    \begin{tabular}{l l l}
        \hline
        Resource & Methods & Description \\
        \hline 
        \multirow{2}{*}{Resource1} & \multirow{2}{*}{POST, PUT} 
            & This resource contains ...\\
          & & \emph{Media types: text/plain, application/json}\\
        \multirow{2}{*}{Resource2} & \multirow{2}{*}{POST, PUT} 
            & This resource contains ...\\
          & & \emph{Media types: text/plain, application/json} \\
        \hline 
    \end{tabular}
    \label{table:resources}
\end{table}
0
10

It’s easy peasy to write multiline cells without fixing the column width with tblr environment of the new LaTeX3 package tabularray: just enclose the cell text with braces and use \\ to break lines:

\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{|l|c|r|}
\hline
 Left & {Center \\ Cent \\ C} & {Right \\ R} \\
\hline
 {L \\ Left} & {C \\ Cent \\ Center} & R \\
\hline
\end{tblr}
\end{document}

enter image description here

8

I don't have direct help on how to add a linebreak, but using the multirow package may provide different route to same desired end. You can read a tutorial here:

http://andrewjpage.com/index.php?/archives/43-Multirow-and-multicolumn-spanning-with-latex-tables.html

But I have a feeling the \parbox answer in the similar question you linked is what you're looking for. I think using a box in the cell is going to be simplest and best way, was there something about that that wasn't working for you?

If you want to use parbox without having to hardcode in a width, here's one way that works for me. Not perfect, since it requires you to know beforehand the text of the longest line in the multi-line column, but it does work:

% define new length and set to length of longest line
\newlength{\longline}
\settowidth{\longline}{longest line in table}\\

\begin{tabular}{lll}

one line & \parbox[t]{\longline}{longest line in table \\ and another line} & more text \\
second line here& and what & more text 
\end{tabular}
2
  • \parbox works, but it requires me to type the desired column width. Thus, I lose the auto-column-size that happens otherwise. I bet \multirow will work, but the source-code will be a lot messy. Commented Aug 28, 2010 at 1:39
  • 1
    Gotcha. Added code sample to my question that uses column autosizing with parbox and is probably cleaner than using multirow package. I think there must be a better way, but at least it works. . . Commented Aug 28, 2010 at 4:38
7

It seems there is a rather simple solution. Just wrap the text into currly braces and use \raggedright like this:

{\raggedright \bfseries WS 2016 \\(average)}

Here is a simple example:

\begin{tabularx}{\textwidth}[ht]{|X|p{1.8cm}|}
  \hline
  Some Longer Column &
  {\raggedright \bfseries Line \\Break} \\\hline
  This is a wide line with some text & Small \\\hline
\end{tabularx}

This gives:

enter image description here

1
  • 1
    This only works in p (or X) columns, but not in l, r, or c columns. Commented Apr 11, 2023 at 18:23
4

When I was younger I was typesetting a tabular environment inside a tabular environment. Since we have TikZ I use the tikzpicture environment inside tabulars, or even a tikzpicture inside a tikzpicture. I prefer putting simple TikZ nodes next and below each other, but it depends on actual task. I enclose an MWE with fast text height correction.

\documentclass{article}
\usepackage{tikz}\pagestyle{empty}
\begin{document}
\tikzset{inner sep=0pt}
\begin{tabular}{|l|l|} \hline
 \begin{tikzpicture}
  \node[align=left, text height=4.5ex]{This is the\\[3pt]first cell};
\end{tikzpicture} 
    & second \\ \hline
    3rd & and the last cell \\ \hline
\end{tabular}
\end{document}

![MWE][1] [1]: https://i.sstatic.net/64Gjo.png

1
  • \tikz \node[align=left, text height=4.5ex]{This is the\\[3pt]first cell}; is a more brief variant.
    – Ali
    Commented Dec 2, 2019 at 22:04
4

You can use the minipage environment:

\begin{minipage}[t]{0.2\columnwidth}%
This is the first line
\newline
second line
\newline
...
\end{minipage}
1
  • 1
    You have to specify width in advance, though...
    – sdaau
    Commented Jul 10, 2014 at 1:06
3

This approach isn't so different from some of the others already given, except that it "externalises" all of the design decisions from the table definition itself (that is, leaving it cleaner to write and read each table should you want to include multiple tables like this throughout your doc or docs).

Preliminaries (presumably in your preamble):

\usepackage{array} % needed if you're going to use \\ together with centering,
                   % raggedright, raggedleft in your column specifier (see
                   % manuals on \arraybackslash)
\newlength{\mywidestcolwidth}
\newcommand*\mycellformat{\protect\footnotesize}
\newcommand*\mytableparskip{\setlength\parskip{4pt}}
\newcommand*\setmywidestcolwidth[1]{
  \settowidth{\mywidestcolwidth}{\mycellformat #1}
}

Usage:

\setmywidestcolwidth{foo baz bar}
\begin{tabular}{|>{\mycellformat}c
                |>{\mytableparskip\mycellformat\centering\arraybackslash}p{\mywidestcolwidth}
                |>{\mycellformat}c|}
\hline
foo bar baz&
foo

foo baz bar

baz& 
foo

foo baz bar

baz\\ \hline
\end{tabular}

Skip the \mycellformat and \parskip if you have no need for them (although not necessary in your case, I included \parskip since it's useful to visually distinguish paragraphs from one another since paragraph indentation is automatically switched off in tables, and added \mycellformat to allow for uniform document-wide table design settings).

3

Personally, I prefer to use \usepackage{multirow} \multirow{"number of rows"}{"width"}{"contents"} for everything else except the information that should be on different rows.

For example:

 \begin{tabular}{p{2.5cm}@{\hskip 0mm}  p{5cm}@{\hskip 4mm} p{5cm} }
     Parameter & Description & Used by\\
     \hline
     \\[-0.1cm]
     \multirow{2}{*}{Accuracy}&1. The error rate or frequency of correctness of sensor readings.  & \\[0.3cm]
     & 2. The degree of correspondence of measured values to actual values.& \\[0.3cm]
      \hline
      \\[-0.1cm]
    \end{tabular}

enter image description here

1
  • This works even without the multirow.
    – ankhi
    Commented Apr 11, 2018 at 5:37
3

You can use adjustbox:

\documentclass{article}

\usepackage{adjustbox}

\begin{document}

\begin{tabular}{|c|c|c|}
\hline
Foo bar & \adjustbox{stack=ll}{Foo\\bar} & Foo bar \\
\hline
\end{tabular}

\end{document}

See also this question.

3

This answer suggests using p-type column and \newline command.

However, once you realize that p-type column is just typesetted in a \parbox (basically a vbox in plain TeX), a paragraph break works.

unofficial documentation

So:

\documentclass{article}
\begin{document}

\begin{tabular}{p{3cm}p{3cm}}
  hello
  
  world&hello

  world
\end{tabular}

\end{document}

I'm not sure why nobody have suggested that given how ⟨blank line⟩ is preferred over \newline or \\ in normal text.

Perhaps it's because of semantic meaning -- you're unlikely to include a whole paragraph in a table cell. But if you do it may make sense.

E.g. the example below includes 2 paragraphs in each table cell.

\documentclass{article}
\usepackage{fullpage}
\begin{document}

\begin{tabular}{p{7cm}p{7cm}}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id,
vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant
morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus
vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor
gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra
ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus.
Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh
mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci
sit amet orci dignissim rutrum.

Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis
vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan
bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi
ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante.
Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla
ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris.
&
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id,
vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant
morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus
vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor
gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra
ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus.
Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh
mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci
sit amet orci dignissim rutrum.

Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis
vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan
bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi
ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante.
Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla
ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris.
\end{tabular}
\end{document}

By default there's no first-line-indent, so the appearance should be identical to as if \newline is used.


Another solution: \shortstack (similar to the nested-tabular solution this does not require specifying explicit width)

1
  • “I'm not sure why nobody have suggested that” → Probably because the majority of people who use LaTeX don't fully understand how it works. Commented Apr 13, 2023 at 7:39
1

It's been a long time, but now you can just use Optex without any packages:

\thistable{\tabskipl=0pt plus1fil \tabskipr=\tabskipl} % center the able
\table{p{5cm\fC}c}{%\fC centers cell
\crll
Here\break we have a broken line & As we want\crll
}

         
\bye

broken table line

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .