3

My code can be found below.

\documentclass[fleqn,10pt]{SelfArx} % Document font size and equations flushed left

\usepackage[font=small]{caption}

% New commands
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\renewcommand{\thefootnote}{NS}

% Load packages
\usepackage{gensymb}
\usepackage{multirow}
\usepackage{tabularx}

%----------------------------------------------------------------------------------------
%   COLUMNS
%----------------------------------------------------------------------------------------

\setlength{\columnsep}{0.55cm} % Distance between the two columns of text
\setlength{\fboxrule}{0.75pt} % Width of the border around the abstract

...

\begin{table}[hbt]
\caption{Fold changes in relaxation parameters in the dorsal muscle and lumbar(/-osacral) IVDs. \\
\begin{tabularx}{\linewidth}{X*{2}{p{0.7cm}} X*{7}{p{0.9cm}}}
\toprule[1.5pt]
                              &       & \multicolumn{2}{c}{\head{Dorsal}} & \multicolumn{5}{c}{\head{IVD}}               \\
                                                            &       & \multicolumn{2}{c}{\head{muscle}}               \\ \cmidrule{3-4} \cmidrule{5-9}
           &                   &       1     & 2     & L3-L4 & L4-L5 & L5-L6 & L6-L7 & L7-S1 \\ \midrule
         & t2/t1 & 0.99$^*$  & 1.24 & 0.64  & 1.05$^*$  & 1.53  & 1.52  & 2.45  \\
\head{T$_{1\rho}$} & t3/t2 & 1.3   & 0.88 & 2.61  & 1.16  & 1.07$^*$  & 1.03$^*$  & 0.7   \\
         & t3/t1 & 1.29  & 1.1$^*$  & 1.68  & 1.22  & 1.63  & 1.56  & 1.72  \\ \midrule
         & t2/t1 & 1.18  & 1.05 & 1.07$^*$  & 1.05$^*$  & 0.83  & 1.43  & 1.32  \\
\head{T$_2$}       & t3/t2 & 0.87  & 1.03 & 0.66  & 0.67  & 0.94$^*$  & 0.69  & 0.67  \\
         & t3/t1 & 1.02$^*$  & 1.08 & 0.71  & 0.7   & 0.78  & 0.99$^*$  & 0.88 \\
\bottomrule[1.5pt]
\end{tabularx}
\label{tab:lbl}
\end{table}
\end{document}

I want to get a table that fits within the width of a column (2 columns on a page, spacing between columns = 0.55 cm, column width ~= 7.925 cm).

I want to decrease the distance from the text to the cell borders for the first two columns, and have the same cell size for the 7 following columns.

Just copied this from answer below Result after using solution propsed below

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Sep 26 '14 at 10:19
  • There is no \begin{document} in your example ;-) And where can we find the SelfArx class? – user31729 Sep 26 '14 at 10:29
  • I'd never use tabularx for numeric data, it is designed to change the linebreaking width of paragraphs of text. – David Carlisle Sep 26 '14 at 12:47
3
\documentclass[10pt]{article} % Document font size and equations flushed left
\usepackage{booktabs}
\usepackage{tabularx}
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\begin{document} 

\noindent\hrulefill a line\hrulefill% to show the linewidth
\def\N{\phantom{0}}

\begin{center}
\begin{tabular}{@{} l l c c *5l @{}}
\toprule[1.5pt]
                              &       & \multicolumn{2}{c}{\head{Dorsal}} & \multicolumn{5}{c}{\head{IVD}} \\
                                                            &       & \multicolumn{2}{c}{\head{muscle}}               \\ \cmidrule{3-4} \cmidrule{5-9}
           &                   &       1     & 2     & L3-L4 & L4-L5 & L5-L6 & L6-L7 & L7-S1 \\ \midrule
         & t2/t1 & 0.99\rlap{$^*$}  & 1.24 & 0.64  & 1.05$^*$  & 1.53  & 1.52  & 2.45  \\
\head{T$_{1\rho}$} & t3/t2 & 1.3\N   & 0.88 & 2.61  & 1.16  & 1.07$^*$  & 1.03$^*$  & 0.7   \\
         & t3/t1 & 1.29  & 1.1\N\rlap{$^*$}  & 1.68  & 1.22  & 1.63  & 1.56  & 1.72  \\ \midrule
         & t2/t1 & 1.18  & 1.05 & 1.07$^*$  & 1.05$^*$  & 0.83  & 1.43  & 1.32  \\
\head{T$_2$}       & t3/t2 & 0.87  & 1.03 & 0.66  & 0.67  & 0.94$^*$  & 0.69  & 0.67  \\
         & t3/t1 & 1.02\rlap{$^*$}  & 1.08 & 0.71  & 0.7   & 0.78  & 0.99$^*$  & 0.88 \\
\bottomrule[1.5pt]
\end{tabular}
\end{center}

\end{document}

enter image description here

  • I've edited the question to clarify my intentions – user18798 Sep 26 '14 at 10:40
  • see edited answer – user2478 Sep 26 '14 at 10:53
  • Should I use \begin{table} before \begin{center}? It still runs through my text :( (see second figure in question above) – user18798 Sep 26 '14 at 13:13
  • Use \begin{table}\centering\caption{...} <the tabular> \end{table} – user2478 Sep 26 '14 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.