1

I am using tabularx to create a simple two column table with long text. First column should be about 1/3 of the width and the second column should occupy the rest of the width.

I am having two issues:

  • The table is created in the output but if I add more than a certain amount of text (I guess depending on the height?) the table disappears and only the caption is left. It should still fit in the page I would guess. It is also not an issue with certain rows. I tried different combinations and if I comment out enough rows it will work.

  • The right vertical line is not aligned with the box of the table.

table with 3 rows commented out

\begin{table}[ht]
  \label{tab:capitalism}
  \caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
    \begin{tabularx}{\linewidth}{|>{\hsize=.35\hsize}X|X|}
      \hline
      \multicolumn{2}{|X|}{Seventh justificatory regime} \tabularnewline \hline
       Equivalency principle (genereal standard) & Activity; project initiation; remote links between people \tabularnewline \hline
       A state of smallness & Inability to get involved, to trust in others, to communicate; close-mindedness, prejudice, authoritarianism, intolerance, stability, overreliance on one's roots, rigidity, etc. \tabularnewline \hline
       A state of greatness & Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters; ability to spread the benefits of social connections, to generate enthusiasm and to increase teammates' employability \tabularnewline \hline
       Directory of subjects & Managers, coaches, innovators  \tabularnewline \hline
       Directory of objects & Computer and information technologies; New organisational devices (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.) \tabularnewline \hline
       Natural relationships & Trusting and being trustworthy; ability to communicate; adaptability to others' needs \tabularnewline \hline
       Greatness ratio & `Great' persons enhance `small' person' employability in return for their trust and enthusiasm for project work, i.e., their ability to take part in another project \tabularnewline \hline
       %Format of investment & Ready to sacrifice all that could curtail one's availability, giving up lifelong plans  \tabularnewline \hline
       %Standard (paradigmic) test & Ability to move from one project to another  \tabularnewline \hline
       %Harmonious figure of natural order & Where the world's natural form resembles that of a network \hline
  \end{tabularx}
\end{table}
4
  • Welcome to TeX.SX! If you use two X type columns and want to adjust their widths using \hsize, the corresponding values must add up to 2. Currently, they only add up to 1.35which is why you observe issue 2. Something like \begin{tabularx}{\linewidth}{|>{\hsize=.66\hsize}X|>{\hsize=1.34\hsize}X|} would thus be more suitable.
    – leandriis
    Apr 4, 2021 at 17:10
  • With the code you provided so far, I can't reproduce the issue of a dissapearing table. Since you mention the caption staying while the table disappears, I guess you document does in fact not compile properly but results in at lease one error message. If that't the case, please state, which error message you get. Please also prepare a minimal working example (MWE) that allows others to reproduce the output you get and add this code to your question.
    – leandriis
    Apr 4, 2021 at 17:11
  • Thank you! My first problem was resolved with your suggestion! The second problem seems to be related to the float specifier. If I remove the [ht] the table is rendered correctly on its own page.
    – Markus
    Apr 4, 2021 at 17:57
  • 2
    Did you think to use description rather than tabularx?
    – egreg
    Apr 4, 2021 at 20:17

4 Answers 4

1

An alternative solution with tblr environment of tabularray package: you can specify coefficients for the X columns.

\documentclass{article}

\usepackage{biblatex}
\usepackage{caption}

\usepackage{tabularray}

\begin{document}

\begin{table}[htp]
  \label{tab:capitalism}
  \caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
    \begin{tblr}{
      colspec = {|X[1]|X[2]|},
      cell{1}{1} = {c=2}{c}, %multicolumn
      hlines,
    }
      Seventh justificatory regime & \\
      Equivalency principle (genereal standard) & Activity; project initiation; remote links between people \\
      A state of smallness & Inability to get involved, to trust in others, to communicate; close-mindedness, prejudice, authoritarianism, intolerance, stability, overreliance on one's roots, rigidity, etc. \\
      A state of greatness & Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters; ability to spread the benefits of social connections, to generate enthusiasm and to increase teammates' employability \\
      Directory of subjects & Managers, coaches, innovators  \\
      Directory of objects & Computer and information technologies; New organisational devices (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.) \\
      Natural relationships & Trusting and being trustworthy; ability to communicate; adaptability to others' needs \\
      Greatness ratio & `Great' persons enhance `small' person' employability in return for their trust and enthusiasm for project work, i.e., their ability to take part in another project \\
  \end{tblr}
\end{table}

\end{document}

enter image description here

1
  • I would specify columns as colspec = {|X[0.3]|X[0.7,j]|},. It gives more compact format of table.
    – Zarko
    Oct 7, 2021 at 5:21
0

The following MWE shows how you could minimize the amount of wasted white space in your table while keeping the width of the first column roughly at 1/3 of the total width. If you prefer the approach using two X type columns, make sure that the values of \hsize add up to 2. Alternatively, you could also use a p type column for the first column and let latex calculate the required width of the second column, which should be easier than the approach using two X type columns.

\documentclass{article}
\usepackage{tabularx}
\usepackage{biblatex}
\usepackage[english]{babel}
\usepackage{calc}
\usepackage{ragged2e}
\begin{document}

\begin{table}
  \label{tab:capitalism}
  \caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
\begin{tabularx}{\linewidth}{|>{\RaggedRight\arraybackslash}p{\widthof{Equivalency principle}}|X|}
%\begin{tabularx}{\linewidth}{|>{\hsize=.66\hsize\raggedright\arraybackslash}X|>{\hsize=1.34\hsize}X|}
%\begin{tabularx}{\linewidth}{|>{\raggedright\arraybackslash}p{0.33\textwidth}|X|}
      \hline
      \multicolumn{2}{|l|}{Seventh justificatory regime} \tabularnewline \hline
       Equivalency principle (genereal standard) & Activity; project initiation; remote links between people \tabularnewline \hline
       A state of smallness & Inability to get involved, to trust in others, to communicate; close-mindedness, prejudice, authoritarianism, intolerance, stability, overreliance on one's roots, rigidity, etc. \tabularnewline \hline
       A state of greatness & Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters; ability to spread the benefits of social connections, to generate enthusiasm and to increase teammates' employability \tabularnewline \hline
       Directory of subjects & Managers, coaches, innovators  \tabularnewline \hline
       Directory of objects & Computer and information technologies; New organisational devices (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.) \tabularnewline \hline
       Natural relationships & Trusting and being trustworthy; ability to communicate; adaptability to others' needs \tabularnewline \hline
       Greatness ratio & `Great' persons enhance `small' person' employability in return for their trust and enthusiasm for project work, i.e., their ability to take part in another project \tabularnewline \hline
       Format of investment & Ready to sacrifice all that could curtail one's availability, giving up lifelong plans  \tabularnewline \hline
       Standard (paradigmic) test & Ability to move from one project to another  \tabularnewline \hline
       Harmonious figure of natural order & Where the world's natural form resembles that of a network \tabularnewline \hline
  \end{tabularx}
\end{table}

\end{document}
0

The sum of the \hsize fractions should equal the amount of X columns. If you want 1:2 ratio you have to use a different approach:

\begin{tabularx}{\linewidth}{
 |
 >{\hsize=\dimexpr 2\hsize/3\relax\raggedright}X
 |
 >{\hsize=\dimexpr 4\hsize/3\relax}X
 |
}

so the sum is 6/3 = 2.

I also suggest a different approach to your table.

\documentclass{article}

\usepackage{tabularx}
\usepackage{biblatex}
\usepackage{caption}

\usepackage{enumitem} % for the second layout

\usepackage{lipsum} % for filler text

\begin{document}

\lipsum[1][1-4]

\begin{table}[htp] % don't forget p

\caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
\label{tab:capitalism} % the label must go after the caption

\begin{tabularx}{\linewidth}{
 |
 >{\hsize=\dimexpr 2\hsize/3\relax\raggedright}X
 |
 >{\hsize=\dimexpr 4\hsize/3\relax}X
 |
}
\hline
\multicolumn{2}{|l|}{Seventh justificatory regime}
\tabularnewline \hline
Equivalency principle (general standard) & 
  Activity; project initiation; remote links between people
\tabularnewline \hline
A state of smallness &
  Inability to get involved, to trust in others, to communicate; close-mindedness,
  prejudice, authoritarianism, intolerance, stability, overreliance on one's roots,
  rigidity, etc.
\tabularnewline \hline
A state of greatness &
  Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters;
  ability to spread the benefits of social connections, to generate enthusiasm
  and to increase teammates' employability
\tabularnewline \hline
Directory of subjects &
  Managers, coaches, innovators
\tabularnewline \hline
Directory of objects &
  Computer and information technologies; New organisational devices
  (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.)
\tabularnewline \hline
Natural relationships &
  Trusting and being trustworthy; ability to communicate; adaptability to
  others' needs
\tabularnewline \hline
Greatness ratio &
  `Great' persons enhance `small' person' employability in return for
  their trust and enthusiasm for project work, i.e., their ability
  to take part in another project
\tabularnewline \hline
%Format of investment &
%  Ready to sacrifice all that could curtail one's availability,
%  giving up lifelong plans
%\tabularnewline \hline
%Standard (paradigmic) test &
%  Ability to move from one project to another
%\tabularnewline \hline
%Harmonious figure of natural order &
%Where the world's natural form resembles that of a network
%\tabularnewline\hline
\end{tabularx}

\end{table}

\lipsum[1-8]

\begin{table}[!htp]

\caption{The grammar of the project-oriented justificatory regime~\autocite[123]{capitalism}.}
\label{tab:capitalism-again} % the label must go after the caption

{\centering Seventh justificatory regime\\}

\begin{itemize}[
  align=left,
  labelwidth=1em,
  leftmargin=1em,
  labelsep=0pt,
  itemsep=0pt,
]

\item \textit{Equivalency principle (general standard)} \\
  Activity; project initiation; remote links between people

\item \textit{A state of smallness} \\
  Inability to get involved, to trust in others, to communicate; close-mindedness,
  prejudice, authoritarianism, intolerance, stability, overreliance on one's roots,
  rigidity, etc.

\item \textit{A state of greatness} \\
  Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters;
  ability to spread the benefits of social connections, to generate enthusiasm
  and to increase teammates' employability

\item \textit{Directory of subjects} \\
  Managers, coaches, innovators

\item \textit{Directory of objects} \\
  Computer and information technologies; New organisational devices
  (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.)

\item \textit{Natural relationships} \\
  Trusting and being trustworthy; ability to communicate; adaptability to
  others' needs

\item \textit{Greatness ratio} \\
  `Great' persons enhance `small' person' employability in return for
  their trust and enthusiasm for project work, i.e., their ability
  to take part in another project

%\item \textit{Format of investment} \\
%  Ready to sacrifice all that could curtail one's availability,
%  giving up lifelong plans
%
%\item \textit{Standard (paradigmic) test} \\
%  Ability to move from one project to another
%
%\item \textit{Harmonious figure of natural order} \\
%Where the world's natural form resembles that of a network

\end{itemize}

\end{table}

\lipsum

\end{document}

enter image description here

enter image description here

I'd avoid h, actually, and probably set a smaller size for the material, which would better distinguish it from the context (and use less space).

0

With {NiceTabular} of nicematrix, you can provide weights to the X columns.

\documentclass{article}
\usepackage{caption}

\usepackage{nicematrix}

\begin{document}

\begin{table}[htp]
  \label{tab:capitalism}
  \caption{The grammar of the project-oriented justificatory regime~1.}
    \begin{NiceTabular}{X[l,1]X[2]}[hvlines]
      \Block[l]{1-2}{Seventh justificatory regime} \\
      Equivalency principle (genereal standard) & Activity; project initiation; remote links between people \\
      A state of smallness & Inability to get involved, to trust in others, to communicate; close-mindedness, prejudice, authoritarianism, intolerance, stability, overreliance on one's roots, rigidity, etc. \\
      A state of greatness & Adaptability, flexibility, polyvalence; sincerity in face-to-face encounters; ability to spread the benefits of social connections, to generate enthusiasm and to increase teammates' employability \\
      Directory of subjects & Managers, coaches, innovators  \\
      Directory of objects & Computer and information technologies; New organisational devices (sub-contracting, flexibility, outsourcing, autonomous units, franchises, etc.) \\
      Natural relationships & Trusting and being trustworthy; ability to communicate; adaptability to others' needs \\
      Greatness ratio & `Great' persons enhance `small' person' employability in return for their trust and enthusiasm for project work, i.e., their ability to take part in another project \\
  \end{NiceTabular}
\end{table}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

output of the above code

You must log in to answer this question.

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