2

I have the following table and need to make its width large in order to keep the inside textsta don't break to two lines:

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\begin{table}

\caption{}

\begin{tabularx}{1.5\textwidth}{XXX}

\hline\hline

Place & Description & Initial marking ($m_0$)\\

\hline

\texttt{MediumGen} & Maximal possible number of bacteria to infect an individual cell & 2000\\
\texttt{SalMediumStart} &  & \\
\texttt{SalCellSurf} &  & \\
\texttt{SalMedium} &  & \\
\texttt{CapCellSurf} &  & \\

\hline\hline

\end{tabularx}

\end{table}

\end{document}

which looks like:

enter image description here

There are two problems: table is not centered and has gone out of the page on the right, and still the text in the middle column is broken to two lines.

Thanks for your help!

EDIT

The answer by @koleygr solves the centering problem. However, when we fill the columns by texts, they overlap:

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\begin{table}

\caption{}

\makebox[\textwidth][c]{\begin{tabularx}{1.5\textwidth}{XlX}

\hline\hline

Place & Description & Initial marking ($m_0$)\\

\hline

 \texttt{XenoEnd} & Signal for the termination of xenophagy & 0\\
 \texttt{XenoIniCounter} & Time counter for the initiation of xenophagy & 0\\
 \texttt{XenoEndCounter} & Time counter for the termination of xenophagy & 0\\
 \texttt{DeathSigCyt} & Signal that the cell undergoes cell death due to a high number of cytosolic \textit{Salmonella} & 0\\
 \texttt{DeathSigVac} & Signal that the cell undergoes cell death due to a high number of vacuolar \textit{Salmonella} & 0\\
 \texttt{WashIni} & Signal for the one-time initiation of the washing process & 1\\
 \texttt{WashCounter} & Time counter of the washing process & 0\\
 \texttt{WashSig} & Signal for the onset of the washing process & 0\\

 \hline\hline

 \end{tabularx}}

 \end{table}

 \end{document}

which looks like

enter image description here

Is there any possibility to force the middle column to be a little more on the right side?

3
  • Please show your reworked code after your EDIT-statement / 2nd screenshot, which produces this overlap (consider shortening as needed, while still being able to be copied and compiled right away). Thanks
    – MS-SPO
    Feb 17, 2023 at 12:47
  • 1
    Try lXX or lXl as column formatter. X indicates: adjust with linebreaks in a „beautiful“ way. With XlX you force the long middle to „disaster“.
    – MS-SPO
    Feb 17, 2023 at 13:17
  • 1
    That's the purpose. So switch to landsacpe page format, reduce the length of your text, reduce font size by \small{your signals here} or \tiny, or deal with it. You may also consider abbreviations, where \dots (... with condition A, ... with condition B, etc.) might be a simple tool. // Depends on what you want to communicate.
    – MS-SPO
    Feb 17, 2023 at 13:32

3 Answers 3

2

Welcome to our community!

Not sure if you are looking for something like this:

\documentclass{article}
\usepackage{tabularx}

\begin{document}

\begin{table}

\caption{}

\makebox[\textwidth][c]{\begin{tabularx}{1.5\textwidth}{XlX}

\hline\hline

Place & Description & Initial marking ($m_0$)\\

\hline

\texttt{MediumGen} & Maximal possible number of bacteria to infect an individual cell & 2000\\
\texttt{SalMediumStart} &  & \\
\texttt{SalCellSurf} &  & \\
\texttt{SalMedium} &  & \\
\texttt{CapCellSurf} &  & \\

\hline\hline

\end{tabularx}}

\end{table}

\end{document}

Output:

enter image description here

EDIT

\documentclass{article}
%\usepackage{tabularx}
\usepackage{makecell}
\begin{document}

\begin{table}

\caption{}

\makebox[\textwidth][c]{\small\begin{tabular}{lll}

\hline\hline

Place & Description & \makecell[lt]{Initial marking\\($m_0$)}\\

\hline

 \texttt{XenoEnd} & Signal for the termination of xenophagy & 0\\
 \texttt{XenoIniCounter} & Time counter for the initiation of xenophagy & 0\\
 \texttt{XenoEndCounter} & Time counter for the termination of xenophagy & 0\\
 \texttt{DeathSigCyt} & Signal that the cell undergoes cell death due to a high number of cytosolic \textit{Salmonella} & 0\\
 \texttt{DeathSigVac} & Signal that the cell undergoes cell death due to a high number of vacuolar \textit{Salmonella} & 0\\
 \texttt{WashIni} & Signal for the one-time initiation of the washing process & 1\\
 \texttt{WashCounter} & Time counter of the washing process & 0\\
 \texttt{WashSig} & Signal for the onset of the washing process & 0\\

 \hline\hline

 \end{tabular}}

 \end{table}

 \end{document}

Output:

enter image description here

1
  • 1
    Thanks @Thom ... Edited. Used \small and \makecell command from the package makecell since you don't really want breaks into the cells except just one break in last column's header
    – koleygr
    Feb 17, 2023 at 17:19
2

Ok, here is a way that elaborates the abbreviation-approach:

  • it puts a list environment below the table inside its float environment (which could be nicer than that)
  • it removed the \makebox
  • it uses package varioref, which expands more nicely, when tables float onto other pages (but needs 2 compile runs)
  • it put some blindtext below the float, just to give an idea about the layout

P.S.: instead of using abbreviations you could also group your parameters, starting with a header (multi-)row writing it out. See e.g. chapter 13 in this data sheet.

\documentclass{article}
\usepackage{tabularx}
\usepackage{varioref}% expands \vref{} statements after 2nd compile
\usepackage{blindtext}

\begin{document}

Table \vref{things} shows important aspects. There may be more, there may be less, more or less \dots

\begin{table}[h]% you chose a float environment for the tables
    \caption{This is what the thingies mean}\label{things}
    \begin{tabularx}{\textwidth}{lXp{1cm}}
        \hline\hline
        
        Place & Description & Initial marking ($m_0$)\\
        
        \hline
        
         \texttt{XenoEnd} & SFT termination of xenophagy & 0\\
         \texttt{XenoIniCounter} & TC for the initiation of xenophagy & 0\\
         \texttt{XenoEndCounter} & TC for the termination of xenophagy & 0\\
         \texttt{DeathSigCyt} & SFTCDDT high number of cytosolic \textit{Salmonella} & 0\\
         \texttt{DeathSigVac} & SFTCDDT high number of vacuolar \textit{Salmonella} & 0\\
         \texttt{WashIni} & SFT one-time initiation of the washing process & 1\\
         \texttt{WashCounter} & TC of the washing process & 0\\
         \texttt{WashSig} & SFT onset of the washing process & 0\\  
         \hline\hline
     \end{tabularx}
     
     \begin{itemize}% a way to do it; not nice, but ...
       \item SFT: Signal for, Signal that       
       \item SFTCDDT: Signal for the cell undergoing cell death due to  
       \item TC: Time Counter 
     \end{itemize}
 \end{table}

\blindtext% just to fill the page

\end{document}

result

1
  • 1
    Fine. Don't miss the latest link to the data sheet ;-)
    – MS-SPO
    Feb 17, 2023 at 14:06
0

Here is a way to incorporate some strategies from writing good tables for data sheets, i.e. for presenting technical information. They try to:

  • reduce text
  • make relevant information more easy to grasp (which includes revealing hickups included in current approaches)
  • having all in one place, or close to.

So these strategies suggest:

  • introducing new column "Type" AND reducing text size to S and TC
  • move explanation of these abbreviations e.g. into the caption
  • using \multicolumn to move redundant text from "Description" (and some \hline decoration)
  • making that overarching text more visible, e.g. via \textsc{}
  • using a shorter entry for the last column (unless the dropped $m_0$ is important).

In the code you'll als see some alternatives to determine the width of the last column. E.g. using unit em, i.e. specifying the width by the number of m-characters in the given font, might be more straight forward than using cm.

Of course you can and should move repeating pattern into dedicated macros (\newcommand). E.g. a row of table entry begs for this. So does the multicolumn decoration. This will result in cleaner code, and more uniform presentation of content.

result

\documentclass{article}
\usepackage{tabularx}
\usepackage{varioref}% expands \vref{} statements after 2nd compile
\usepackage{blindtext}


\begin{document}

Table \vref{things} shows important aspects. There may be more, there may be less, more or less \dots

\begin{table}[h]% you chose a float environment for the tables
    % <<< changed caption; includes Type description
    \caption{Signals and time counters for this cell investigations, with Types \textit{S:~Signal, TC: Time Counter}}\label{things}
    
    % <<< added column "Type"  to allow for shorter text in column "Description"
    \begin{tabularx}{\textwidth}{llXc}%p{3.0em}}% <<< some variations
        \hline\hline
        
        Place & Type & Description & Initial\\% marking ($m_0$)\\% <<<why not making it shorter?
        \hline

        \texttt{XenoEnd}        & S     & termination of xenophagy & 0\\
        \texttt{XenoIniCounter} & TC    &  initiation of xenophagy & 0\\
        \texttt{XenoEndCounter} & TC    & termination of xenophagy & 0\\

        \hline
        \multicolumn{4}{l}{\textsc{Cell undergoes cell death due to:}}\\% <<< NEW
        \texttt{DeathSigCyt}    & S     &  a high number of cytosolic \textit{Salmonella} & 0\\
        \texttt{DeathSigVac}    & S     & a high number of vacuolar \textit{Salmonella} & 0\\
        \hline

        \texttt{WashIni}        & S     & one-time initiation of washing process & 1\\
        \texttt{WashCounter}    & TC    & of washing process & 0\\
        \texttt{WashSig}        & S     & onset of the washing process & 0\\

        \hline\hline
    \end{tabularx}
 \end{table}

\blindtext% just to fill the page

\end{document}

You must log in to answer this question.