4

I'm working with tabularx and now I'd like to combine all 3 cells of one line to a single one, but my text is quite long and I don't know how to get it to make automatic linebreak in the text in this environment. Someone know what I should do?

\documentclass[10pt,a4paper,final,twoside]{book}
\usepackage{amsmath}

\usepackage{tabularx}
\usepackage{makecell}
\usepackage{multirow}

\usepackage{multicol}
\setlength{\columnsep}{1.5cm}
\setlength{\columnseprule}{0.2pt}

\usepackage{polyglossia}
\setmainlanguage{french}

  \begin{document}
  \begin{center}
    \begin{tabularx}{1.\linewidth}{|p{.31\linewidth} | p{.31\linewidth} |     p{.31\linewidth} |}
    \hline 
    \textbf{Ernout/Meillet\textsubscript{4}} & \textbf{REW\textsubscript{3}} & \textbf{DÉRom}  \\ 
    \hline 
    apert\={u}ra & ap\u{e}rt\={u}ra & \makecell[l]{*/aper\textquotesingle t-ur-a/\\\hspace{4pt} $\longrightarrow$ I. */aper\textquotesingle t-ur-a/  \\ \hspace{4pt} $\longrightarrow$ II. */oper\textquotesingle t-ur-a/} \\ 
    \hline
    \multicolumn{3}{|c|}{Les issues romanes ont été subdivisées selon les deux types dont elles relèvent : */aper't-ur-a/ (I.) et */oper't-ur-a/ (II.). I. représente une évolution phonétique régulière de protorom. */aper't-ur-a/ et il existe en italien, romanche, espagnol, asturien, galicien et portugais....  }   \\
    \hline 
    \end{tabularx} 
    \end{center}

enter image description here

  • sidenote never use tabularx without X columns – Moriambar Jul 1 '17 at 19:52
5

Use X columns and a p column for the last part.

\documentclass[10pt,a4paper,final,twoside]{book}
\usepackage{amsmath}

\usepackage{tabularx}
\usepackage{makecell}
\usepackage{polyglossia}

\setmainlanguage{french}

\begin{document}

\begin{center}

\begin{tabularx}{\linewidth}{|X|X|X|}
\hline 
\textbf{Ernout/Meillet\textsubscript{4}} & \textbf{REW\textsubscript{3}} & \textbf{DÉRom}  \\ 
\hline 
apert\={u}ra & ap\u{e}rt\={u}ra & 
  \makecell[l]{%
    */aper\textquotesingle t-ur-a/\\
    \hspace{4pt} $\longrightarrow$ I. */aper\textquotesingle t-ur-a/ \\
    \hspace{4pt} $\longrightarrow$ II. */oper\textquotesingle t-ur-a/
  } \\
\hline
\multicolumn{3}{|p{\dimexpr\linewidth-2\tabcolsep-2\arrayrulewidth}|}{%
  Les issues romanes ont été subdivisées selon les deux types dont elles
  relèvent: */aper't-ur-a/ (I.) et */oper't-ur-a/ (II.). I. représente
  une évolution phonétique régulière de protorom. */aper't-ur-a/ et il
  existe en italien, romanche, espagnol, asturien, galicien et portugais....  } \\
\hline 
\end{tabularx} 
\end{center}

\end{document}

enter image description here

3

What I propose is a cleanup solution. IE:

  1. Removed extra spacing from the sides of the table
  2. Removed tabularx since no X columns are used
  3. For the new column I used @{}m{\textwidth}@{} in fact:

    a. the @{} get rid of the extra spacing

    b. the \textwidth gives the breadth needed (tweakable to obtain the best effect)

    c. the m specifications allows the cell to hyphenate

  4. Got rid of all of the vertical separator because of their ugliness and because they impair readability

  5. Used the booktabs rules because they are fancier
  6. removed extra horizontal lines (at most one can consider a midrule before the long cell

So here is the code

\documentclass[10pt,a4paper,final,twoside]{book}
\usepackage{amsmath}

\usepackage{tabularx, booktabs}
\usepackage{makecell}
\usepackage{multirow}

\usepackage{multicol}
\setlength{\columnsep}{1.5cm}
\setlength{\columnseprule}{0.2pt}

\usepackage{polyglossia}
\setmainlanguage{french}

  \begin{document}
  \begin{center}
    \begin{tabular}{@{}p{.31\linewidth} p{.31\linewidth}  p{.31\linewidth}@{}}
\toprule
    \textbf{Ernout/Meillet\textsubscript{4}} & \textbf{REW\textsubscript{3}} & \textbf{DÉRom}  \\ 
    \midrule 
    apert\={u}ra & ap\u{e}rt\={u}ra & \makecell[l]{*/aper\textquotesingle t-ur-a/\\\hspace{4pt} $\longrightarrow$ I. */aper\textquotesingle t-ur-a/  \\ \hspace{4pt} $\longrightarrow$ II. */oper\textquotesingle t-ur-a/} \\ 

    \multicolumn{3}{@{}m{\textwidth}@{}}{Les issues romanes ont été subdivisées selon les deux types dont elles relèvent : */aper't-ur-a/ (I.) et */oper't-ur-a/ (II.). I. représente une évolution phonétique régulière de protorom. */aper't-ur-a/ et il existe en italien, romanche, espagnol, asturien, galicien et portugais....  }   \\
    \bottomrule 
    \end{tabular} 
    \end{center}

    \end{document}

And a sample

enter image description here

3

Use p{\dimexpr0.93\linewidth+4\tabcolsep} for the width and. of course, no tabularx:

\documentclass[10pt,a4paper,final,twoside]{book}
\usepackage{amsmath}

\usepackage{tabularx}
\usepackage{makecell}
\usepackage{multirow}

\usepackage{multicol}
\setlength{\columnsep}{1.5cm}
\setlength{\columnseprule}{0.2pt}

\usepackage{polyglossia}
\setmainlanguage{french}

\begin{document}

\begin{center}
    \begin{tabular}{|*3{p{.31\linewidth} |}}\hline 
    \textbf{Ernout/Meillet\textsubscript{4}} & \textbf{REW\textsubscript{3}} & 
    \textbf{DÉRom}  \\ \hline 
            apert\={u}ra & ap\u{e}rt\={u}ra & \makecell[l]{*/aper\textquotesingle 
            t-ur-a/\\\hspace{4pt} $\longrightarrow$ I. */aper\textquotesingle t-ur-a/  \\ 
    \hspace{4pt} $\longrightarrow$ II. */oper\textquotesingle t-ur-a/} \\ \hline
\multicolumn{3}{|p{\dimexpr0.93\linewidth+4\tabcolsep}|}{Les issues romanes ont été 
subdivisées selon les deux 
types dont elles relèvent : */aper't-ur-a/ (I.) et */oper't-ur-a/ (II.). I. 
            représente une évolution phonétique régulière de protorom. */aper't-ur-a/ et 
            il existe en italien, romanche, espagnol, asturien, galicien et portugais....  
            }   \\\hline 
\end{tabular} 
\end{center}
\end{document}

enter image description here

With tabularx it should be:

\begin{tabularx}{\linewidth}{|X|X|X|}\hline 
... 
\multicolumn{3}{|p{\dimexpr\linewidth-2\tabcolsep}|}{...}
 ...
\end{tabularx}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.