I need some help regarding formatting a table in tabularx (I'm only allowed to use tabularx). I'm encountering some problems and I can't diagnose the issue as this is the first time I am using Latex.
This is the code which I written so far:
\documentclass{article}
\usepackage{amssymb}
\usepackage{tabularx}
\usepackage{multirow}
\begin{document}
\begin{table}[htbp]
\centering
\caption{This is a table}
\begin{tabularx}{\textwidth}{|X|c|c|c|c|c|c|c|c|} \hline
\multirow{2}{*}{xxxxxx} & \multirow{2}{*}{xxxxxx} & \multicolumn{2}{c|} {xxxxx xxxx} & \multicolumn{5}{c|}{xxxxxxxxxx} \\ \cline{3-9}
& & xxxxxxxx & xxxxxxxxxxx & xxxxxxxx & xxxxx & xxxxxxxxx & \multicolumn{2}{c|}{xxxxx} \\ \hline
xxxxxxx et al. (1900) & xxxxx & \multicolumn{2}{c|}{xxxxxx} & xxxxxxxxx & xxxxxx & xxx & $\thicksim$x km & for x = 0.1 \\ \cline{8-9}
& & & & & & & $\thicksim$y km & for x = 0.2 \\ \cline{8-9}
& & & & & & & $\thicksim$z km & for x = 0.3 \\ \cline{8-9}
\end{tabularx}
\end{table}
\end{document}
I got the result as shown below (the first 2 rows are headers):
The problems I faced for this table were:
1) How do I remove the blank spaces along the columns which are not affected by the cline function?
2) The first column contains a citation. How can I make the author's name wrap within the cell? This is circled in blue
3) For the cells circled in red, how can I shift them up, so that they are just below the ~x km for x = 0.1 row?
4) How can I get rid of the | vertical separators between the third and fourth columns after the top 2 header rows??
Thank you all in advance.
Regards Corse
\begin{document} \usepackage{tabularx} \usepackage{multirow}
would generate an error. (I fixed it this time:-) – David Carlisle Sep 28 '15 at 8:37c
which does not allow linebreaking, then put so manyx
in each cell that the table is wider than text width and tabularx can do nothing about that. So you need to restructure your table, or use a smaller font, or allow line breaking, but without real text it is a bit hard to suggest the best places to allow line breaks. – David Carlisle Sep 28 '15 at 8:40x
such that they correspond to the original length of characters. In that case, should I convert all thec
tox
? – Corse Sep 28 '15 at 8:43