1

For

\multirow{3}*{\minitab[c]{India \\ Canada}}

I get various error messages in the code below; whereas both

\multirow{3}*{India Canada}

and

\multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\

just work.

I can't see what's wrong, plz help. Thank you!

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{eurosym}
\usepackage{multirow}
\newcommand{\minitab}[2][c]{\begin{tabular}{#1}#2\end{tabular}}

\renewcommand{\arraystretch}{1.2}
%\sisetup{round-mode=places,round-precision=1, add-decimal-zero=true, add-integer-zero=true, round-integer-to-decimal}

\begin{document}

\begin{table}




\begin{tabular}{|c|c|}
\hline
\multirow{4}{1in}{Common g text} & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline

\multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline
\end{tabular}

\noindent
\begin{tabulary}{\textwidth}{|C|C|}
\hline
\multirow{4}{1in}{Common g text} & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline

\multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline
\end{tabulary}

\end{table}

bla

\begin{table}
\centering
\begin{threeparttable}
\caption{Cricket results 2013}
\sisetup{round-mode=off, add-decimal-zero=false, add-integer-zero=false}

\begin{tabulary}{\textwidth}{@{}*{1}{L}*{2}{S[table-format=5.0]}*{1}{S[table-format=2.0]}@{}} \toprule

& \multicolumn{2}{c}{Ticket price (\euro)}  &\multicolumn{1}{c}{Chance to win (\%)}\\

\cmidrule(lr){2-3}

& {from}    &{until}    & \\
\midrule
\multirow{3}*{\minitab[c]{India \\ Canada}}
& {0} & 25000   &22\\
& 25001 & 42000 &32 \\
& 42001 & {$\infty$}    &42 \\
&&& \\
\multirow{3}*{Tasmania}
& {0} & 50000   &26\\
& 50001 & {$\infty$}    &33 \\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [1] Average.

\end{tablenotes}

\end{threeparttable}
\end{table}

\end{document}
ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149

1 Answers1

4

Not sure why but mutirow doesn't seem to like tabulary's trial run so you can omit its content during the trial.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{eurosym}
\usepackage{multirow}
\newcommand{\minitab}[2][c]{\begin{tabular}{#1}#2\end{tabular}}

\renewcommand{\arraystretch}{1.2}
%\sisetup{round-mode=places,round-precision=1, add-decimal-zero=true, add-integer-zero=true, round-integer-to-decimal}

\begin{document}

\begin{table}




\begin{tabular}{|c|c|}
\hline
\multirow{4}{1in}{Common g text} & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline

\multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline
\end{tabular}

\noindent
\begin{tabulary}{\textwidth}{|C|C|}
\hline
\multirow{4}{1in}{Common g text} & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline

\multirow{4}*{\minitab[c]{Common \\ g text}} & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline
\end{tabulary}

\end{table}

bla

\begin{table}
\centering
\begin{threeparttable}
\caption{Cricket results 2013}
\sisetup{round-mode=off, add-decimal-zero=false, add-integer-zero=false}

\begin{tabulary}{\textwidth}{@{}*{1}{L}*{2}{S[table-format=5.0]}*{1}{S[table-format=2.0]}@{}} \toprule

& \multicolumn{2}{c}{Ticket price (\euro)}  &\multicolumn{1}{c}{Chance to win (\%)}\\

\cmidrule(lr){2-3}

& {from}    &{until}    & \\
\midrule
\multirow{3}*{\ifx\[$\else\minitab[c]{India\\Canada}\fi}
& {0} & 25000   &22\\
& 25001 & 42000 &32 \\
& 42001 & {$\infty$}    &42 \\
&&& \\
\multirow{3}*{Tasmania}
& {0} & 50000   &26\\
& 50001 & {$\infty$}    &33 \\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [1] Average.

\end{tablenotes}

\end{threeparttable}
\end{table}

\end{document}

Actually it seems to be an interaction with threeparttable, it ends up trying to typeset the threepart table caption at the end of the inner table inside the multirow. So a better workaround which will allow tabulary to see and measure the inner table is to save the original definition of tabular and reset it for the nested table:

Put this in the preamble:

\let\xxx\tabular
\let\endxxx\endtabular

then

\multirow{3}*{%
\let\tabular\xxx
\let\endtabular\endxxx
\minitab[c]{India\\Canada}
}
ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
David Carlisle
  • 757,742
  • Now I've got the \multirow cell crashing into the neighbouring cells (not in the MWE above, but in "the real thing"). Is there a way to have tabulary "measure" the longest line in the multirow? Or to manually specify: "tabulary, please use the length of {the longest line}" ? – nutty about natty Apr 19 '13 at 17:18
  • Or as an alternative idea (as I'll have an empty row between the data anyway): I could have {the longest line} in that empty row but "invisible" (how?). Maybe that would help? – nutty about natty Apr 19 '13 at 17:27
  • Just used \phantom{the longest line}, see http://tex.stackexchange.com/questions/4519/how-do-i-create-an-invisible-character, in the blank row and that did the trick for me. But maybe you have an alternative, better idea? – nutty about natty Apr 19 '13 at 17:35
  • 1
    @nuttyaboutnatty updated code – David Carlisle Apr 19 '13 at 19:32
  • the road to perfection (aka the road to perdition...): am having trouble now to make the left column align all the way to the left, see http://paste.ubuntu.com/5724318/ The price to pay for "too much" nesting? – nutty about natty Apr 20 '13 at 12:40
  • I guess I'd need to put @{} and {}@ "somewhere" into the header... – nutty about natty Apr 20 '13 at 12:52
  • SOLVED. \minitab[@{}l@{}]{India\\Canada} (in the document body) did the trick. :) – nutty about natty Apr 20 '13 at 13:06