3

Where I did wrong?

\begin{table} \begin{center} \begin{tabularx}{\textwidth}{YYYYYYY} \toprule \textbf{Style} & \multicolumn{2}{c}{\textbf{Yarn}} & & \multicolumn{2}{c}{\textbf{Count}} & \textbf{Weight} & \textbf{Thickness} \\ \cmidrule{2-3} \cmidrule{4-5} & Warp & Fill & Ends & Picks & $[g/m^2]$ & $[mm]$\\ \midrule Plain & TR 30S 3L & TR 30S 3L & $4.87$ & $4.87$ & 200 & $0.23$ \\ \bottomrule \end{tabularx} \caption{Caption} \end{center} \end{table} 

thanks for help!

4
  • 4
    you declared 7 columns and your first row has 8 cells. Commented Oct 21, 2015 at 8:32
  • 1
    Welcome to tex.sx (in general though please make your examples complete so people can run them. tabularx, Y, \toprule, \cmidrule are not defined by default (I can guess some pacakages you have used, but I can't guess how Y is defined (although in this case it doesn't matter, you'd get the same form c :-) Commented Oct 21, 2015 at 8:35
  • thanks for help, When I use the command \multicolumn{2}{c}{\textbf{Yarn}} it counts as 2 cells? and by the way Y is defined as: \newcolumntype{Y}{>{\centering\arraybackslash}X} Commented Oct 21, 2015 at 8:39
  • yes multicolumn{2}.... spans 2 columns. Commented Oct 21, 2015 at 9:14

2 Answers 2

1

Here are some suggestions on how you may want to streamline your code:

  • Use left- and right-clipping of the \cmidrule lines to better;

  • there's no need to use a center environment because the width of the tabularx environment is set to \textwidth;

  • don't typeset units of measurement in math italics -- consider using the \si macro of the siunitx package instead;

  • when using a smaller-than-normal font size for a table, do also consider reducing the amount of intercolumn whitespace: for the table at hand, a combination of \small (instead of \footnotesize) and setting \tabcolsep (the parameter that governs the amount of intercolumn whitespace) to 4pt (default: 6pt) would seem to yield a more-readable table.

  • The first column may look better if you use l instead of Y as the column type.

enter image description here

\documentclass{article} \usepackage{tabularx,booktabs} \newcolumntype{Y}{>{\centering\arraybackslash}X} \usepackage[per-mode=symbol]{siunitx} % for typesetting scientific units \begin{document} \begin{table} \setlength\tabcolsep{4pt} % default value: 6pt \small % not: "\footnotesize" \begin{tabularx}{\textwidth}{@{} l *{6}{Y} @{}} \toprule \textbf{Style} & \multicolumn{2}{c}{\textbf{Yarn}} & \multicolumn{2}{c}{\textbf{Count}} & \textbf{Weight} & \textbf{Thickness} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} & Warp & Fill & Ends & Picks & [\si{\gram\per\meter\squared}] & [\si{\milli\meter}]\\ \midrule Plain & TR 30S 3L & TR 30S 3L & 4.87 & 4.87 & 200 & 0.23 \\ \bottomrule \end{tabularx} \caption{Main Properties of wowen fabric.} \end{table} \end{document} 

Just for comparison, here's the look of the table that's produced by the code you presented in your answer:

enter image description here

2
  • thanks a lot! do you know where I can find the documentation about siunitx package? Commented Oct 22, 2015 at 4:09
  • @AndreaBetti -- You may bring up the package's user guide by typing texdoc siunitx in a command window. Commented Oct 22, 2015 at 4:31
1

I find a way that it works!

\begin{table} \begin{center} \begin{footnotesize} \begin{tabularx}{\textwidth}{YYYYYYY} \toprule \textbf{Style} & \multicolumn{2}{c}{\textbf{Yarn}} & \multicolumn{2}{c}{\textbf{Count}} & \textbf{Weight} & \textbf{Thickness} \\ \cmidrule{2-3} \cmidrule{4-5} & Warp & Fill & Ends & Picks & $[g/m^2]$ & $[mm]$\\ \midrule Plain & TR 30S 3L & TR 30S 3L & $4.87$ & $4.87$ & 200 & $0.23$ \\ \bottomrule \end{tabularx} \caption{Main Properties of wowen fabric.} \end{footnotesize} \end{center} \end{table} 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.