GeneralA clash between tabu and mathtools

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

A clash between tabu and mathtools

Post by pallav »

I have written the whole thesis with tabu. I got help for this from here. Now for the long both side arrow, I have used mathtools. But a clash is occurring. Use of tabu is a must. Now what is the solution:

Code: Select all

\documentclass[11pt]{article}
\usepackage{caption}
\usepackage{booktabs,multirow,amsmath,amssymb,array}
\usepackage{tabu}
\usepackage{mathtools}
\begin{document}
$a \xLeftrightarrow{z_1=z_2+z+3+z_4} b$
\begin{table}[!ht]
  \caption{Markov channel parameter settings}
  \label{tab:markovchapara}
  \small\tabulinesep=1mm
  \begin{tabu} to \linewidth {X[1.5c]X[$2C]X[$2C]X[$2C]X[$2C]}
   \toprule
    \multirow{2}{*}[0.5ex]{Channel $j$} &
    \multicolumn{2}{p{\dimexpr 7\linewidth/19\linewidth-5\tabcolsep}}{A long, long, long, long, long line, that is broken} &
    \multicolumn{2}{p{\dimexpr 7\linewidth/19\linewidth-5\tabcolsep}}{A long, long, long, long, long line, that is broken} \\
   \cmidrule(r){2-3}\cmidrule(r){4-5}
     & p_j & q_j & \pi_{bj}   & \pi_{ij} \\
   \midrule
    1 & - \Bigl( 2\,\alpha\,L - L + 2\,\alpha -\alpha^{2} \Bigr)
      & \lambda^{2}+\Omega_{1}\lambda + \Omega_{2}
      & \frac{\beta\,y^*\alpha}{( x^* + \alpha )^{2}}
      & -{\omega}^{2}+i\Omega_{{1}}\omega+\Omega_{{2}}  \\
    2 & \Bigl( L\,\beta\,\frac{\beta-\gamma}{\delta} + \alpha \bigl(2\,L-\alpha-\alpha\,L \bigr)\Bigr)
      & -\omega^{2} + a_{10}b_{01} - \cos(\omega\,\tau) a_{01}b_{10}
      & \alpha\,L\, \frac{\delta\,\alpha - \gamma\,\beta}{\delta}
      & -\omega ( a_{10} + b_{01} ) +\sin(\omega\,\tau) a_{01}b_{10}  \\
   \bottomrule
   \tabuphantomline
  \end{tabu}
\end{table}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

A clash between tabu and mathtools

Post by cgnieder »

The clash apparently happens because »mathtools« loads »calc«. It is resolved if you change the \dimexpr to the correct syntax. I don't know why it works without »calc« since it shouldn't. A dimension expression must follow the syntax

Code: Select all

<dimension>*<skalar> + <dimension>*<skalar> ...
that is, in a multiplication the dimension must be the first factor.

Code: Select all

\documentclass[11pt]{article}
\usepackage{caption}
\usepackage{booktabs,multirow,amsmath,amssymb,array}
\usepackage{mathtools}
\usepackage{tabu}

\begin{document}
$a \xLeftrightarrow{z_1=z_2+z+3+z_4} b$

\begin{table}[!ht]
  \caption{Markov channel parameter settings}
  \label{tab:markovchapara}
  \small\tabulinesep=1mm
  \begin{tabu} to \linewidth {X[1.5c]X[$2C]X[$2C]X[$2C]X[$2C]}
   \toprule
    \multirow{2}{*}[0.5ex]{Channel $j$} &
    \multicolumn{2}{p{\dimexpr\linewidth*8/19 -\tabcolsep*3\relax}}{A long, long, long, long, long line, that is broken} &
    \multicolumn{2}{p{\dimexpr\linewidth*8/19 -\tabcolsep*3\relax}}{A long, long, long, long, long line, that is broken} \\
    \tabuphantomline
   \cmidrule(r){2-3}\cmidrule(r){4-5}
     & p_j & q_j & \pi_{bj}   & \pi_{ij} \\
   \midrule
    1 & - \Bigl( 2\,\alpha\,L - L + 2\,\alpha -\alpha^{2} \Bigr)
      & \lambda^{2}+\Omega_{1}\lambda + \Omega_{2}
      & \frac{\beta\,y^*\alpha}{( x^* + \alpha )^{2}}
      & -{\omega}^{2}+i\Omega_{{1}}\omega+\Omega_{{2}}  \\
    2 & \Bigl( L\,\beta\,\frac{\beta-\gamma}{\delta} + \alpha \bigl(2\,L-\alpha-\alpha\,L \bigr)\Bigr)
      & -\omega^{2} + a_{10}b_{01} - \cos(\omega\,\tau) a_{01}b_{10}
      & \alpha\,L\, \frac{\delta\,\alpha - \gamma\,\beta}{\delta}
      & -\omega ( a_{10} + b_{01} ) +\sin(\omega\,\tau) a_{01}b_{10}  \\
   \bottomrule
   \tabuphantomline
  \end{tabu}
\end{table}

\end{document}
Regards
site moderator & package author
pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

Re: A clash between tabu and mathtools

Post by pallav »

Thanks a lot. It works good.
Post Reply