New answers tagged tabularx
1
You can use a new column type:
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
with the help of array package.
Complete code:
\documentclass{article}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
% Unwrapped example
\begin{tabular}{l*{7}{c}}
Team & P ...
1
To have wrapping columns of a fixed width that aligns right or centered, you need to define them, e.g. using the array package and \newcolumntype.
The code belows shows possible definitions for left L, right R and centered C columns, and applies the C one to your MWE:
\documentclass{article}
\usepackage{array}
...
5
\documentclass{standalone}
\usepackage{tabularx}
\usepackage{diagbox}
\begin{document}
\begin{tabularx}{\textwidth}{|X|c|c|c|}
\hline
\backslashbox[\dimexpr\linewidth+2\tabcolsep]{Task}{Question} & 1 & 2 & 3\\
\hline
What? & Yes & Yes & Yes \\
\hline
\end{tabularx}
\end{document}
3
Remarks for the example below:
Package raggedright provides \RaggedRight that is similar to \raggedright, but allows hyphenation to get a smoother right margin, especially for narrow columns.
>{\itspape}lX: Your example image does not contain italics. Also this are two columns, a left-aligned column and an extensible column that allows several lines. ...
1
[...]
\usepackage{tabularx,booktabs,ragged2e}
[...]
\begingroup
\noindent\tabcolsep=3pt
\begin{tabularx}{\linewidth}{@{}r>{\RaggedRight}X>{\RaggedRight}Xl @{}}\toprule
[...]
\end{tabularx}
\endgroup
[...]
5
Please always post complete documents showing all packages used.
You had fragile commands in the caption, which I avoided by supplying a short caption for the list of tables, and in the tabularx you had specified far more columns than your data used.
\documentclass{article}
\usepackage{tabularx,booktabs}
\begin{document}
\begin{table}[htbp]
...
2
X columns are just p columns which are all set to the same width, where the width is calculated to make the total table width the specified size. So all the X and Y columns in your table are the same width,
All the entries in that column are single line so you could just use c so the column is set to the natural width of its content.
Or use \tabulary ...
5
It depends what you want
It is certainly possible to ask the question. (Just use a p column if you want specified width)
\hsize works.
Use p m b for fixed width columns, and use c l r or X in columns without a pre-specified width.
Or you could use tabulary (which is easier to use really).
0
I just had the same problem- turns out I had an errant \\ at the end of my final \item.
Looks like you also have an extra \\ after \end{itemize} - try deleting it and see if that helps- worked for me!
1
The command \footnote is divided into \footnotemark and \footnotetext.
\documentclass{article}
\usepackage{tabularx}[1999/01/07] % v2.07
\usepackage{hyperref}% 2012/10/15 v6.83k
\listfiles
\begin{document}
\begin{minipage}[t]{.5\linewidth}
\begin{tabularx}{\linewidth}{c}
text\footnote{footnote test}
and text\footnotemark %1
and text\footnotemark %2
\\
...
0
Another solution could be
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\textwidth}{X!{\vrule width -3cm} X}
\textbf{Greetings} & Refer to counter parts as Mr., Ms. or Mrs \\
\textbf{Gift Giving} & Gift giving is practised but not necessary. Taking someone out is also considered a gift. Gifts are generally given ...
2
Code
\documentclass{article}
\usepackage{tabularx,lipsum}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{@{}>{\bfseries}l X@{}}
Greetings & Refer to counter parts as Mr., Ms. or Mrs ...
1
For example:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\newlength{\first}
\settowidth{\first}{\textbf{Time Management }}
\begin{tabularx}{\textwidth}{p{\first} X}
\textbf{Greetings} & Refer to counter parts as Mr., Ms. or Mrs \\
\textbf{Gift Giving} & Gift giving is practised but not necessary. Taking someone out is also ...
3
You should add >{\centering} before the relevant column, or more conveniently define a new column type as follows:
\documentclass{article}
\usepackage{tabularx}
\newcolumntype{Z}{>{\centering\arraybackslash}X}
\begin{document}
\begin{tabularx}{\textwidth}{ |Z|Z|Z|Z|Z|Z| }
\hline
Equation & 2 & 3 & 5 & 7 \\
\hline
$y_0 = b^{t}$ ...
2
I am not sure what you meant with "the text is in grouped style", but I assumed that you meant that there are some wide blank spaces between words dut to know problems in narrow columns. To prevent this, you can use a new column type with \raggedright for the X columns (you could also use \RaggedRight after loading ragged2e):
\documentclass{article}
...
2
Placing any alignment material (including \hline) in the end clause here doesn't work, I think because of the way tabularx scans ahead for the table material.
Fortunately there is a much easier approach using the environ package. First a simple basic example:
\documentclass[12pt,a4paper]{article}
\usepackage{tabularx,environ}
...
4
This takes two runs of latex to measure things
\documentclass{article}
\usepackage{tabularx}
\makeatletter
\def\savepos#1{\leavevmode\pdfsavepos\write\@auxout{%
\gdef\noexpand#1{\the\pdflastypos sp }}}
\def\xstart#1{\expandafter\savepos\csname save@start@#1\endcsname}
\def\xend#1{\expandafter\savepos\csname save@end@#1\endcsname}
\def\xpad#1#2#3{%
...
5
There appears to be a dependency on colortbl
\documentclass{article}
\usepackage{array,tabularx,colortbl}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[tabularx={X|X},title=table]
cell A & Cell B\\\hline
cell C & Cell D
\end{tcolorbox}
\end{document}
Top 50 recent answers are included
