0

I have a Problem with the combination of tabulary, math mode ( $...$ ) and arraystretch.

I have some tabularys and there is some text in it in math mode. The problem is, that the text is exactly as high as the cell hight, and I want there to be some space between the equation and the borders. Usually it works with arraystretch, but in this case it's not working (maybe it has something to do with using math mode?)

I'll try to give a minimal example of my problem:

\documentclass[a4paper, 12pt, DIV10]{book}
\usepackage{tabulary}
\usepackage{amsmath}


\begin{document}


tabulary without arraystretch
\begin{tabulary}{0.3\textwidth}{|c|c|}
\hline
$ \dfrac{\sqrt[3]{27x^5y^9}}{3xy^3}$ & \\ \hline
$ \dfrac{\sqrt{4x^3}}{x}$&  \\ \hline
$ \dfrac{\sqrt{18x^4}}{x^2}$&  \\ \hline
\end{tabulary}
\vspace{1cm}

tabulary with arraystretch\{2\}
\renewcommand{\arraystretch}{2}
\begin{tabulary}{0.3\textwidth}{|c|c|}
\hline
$ \dfrac{\sqrt[3]{27x^5y^9}}{3xy^3}$ &  \\ \hline
$ \dfrac{\sqrt{4x^3}}{x}$&  \\ \hline
$ \dfrac{\sqrt{18x^4}}{x^2}$&  \\ \hline
\end{tabulary}


\end{document}

You can see, that both tabularys are exactly the same:

enter image description here

I'd like to have a solution for this problem, where I can predefine the hight, not for every cell separately, because there will be a lot of tabularys in my document.

thanks in advance :)

7
  • 1
    \setlength\extrarowheight{5pt} – David Carlisle Aug 9 '16 at 14:31
  • tabulary with just cc columns and no CLR columns can not do anything very useful – David Carlisle Aug 9 '16 at 14:32
  • Probably easier to use struts (assumes the array package) \newcommand\test{\rule[-1.8em]{0.4pt}{4em}} once ok (change 0.4pt to 0pt) and insert it in a column via |>{\test}c|c| – daleif Aug 9 '16 at 14:57
  • @DavidCarlisle I need tabulary for automatic column break and multicolumn - what do you mean with your comment that it's not useful the way i use it? \extrarowheight doesn't work the way I want it - it just fills the space above the equation (text should still be fully centered in the cell). Same with the \newcommand. But thanks for your help :) – Karfloffel Aug 9 '16 at 15:31
  • 1
    tabulary introduces new uppercase column types C, L, R that allow line breaking to an automatically determined width. You ar using c which is a single line entry not allowing linebreaking. If all columns are c then the table is just natural width and tabulary has no way to achieve the specified width in the first argument. – David Carlisle Aug 9 '16 at 17:18
1

Actually, the arraystretch example does work, your factor was just too low to notice any significant difference. Try upping the factor, you'll see! :)

1
  • haha, you're right, thanks - but when I have vectors in my equation, the parentheses are always the exact same hight as the cell. Arraystretch works, but when i use parentheses [ \left( ... \right) ], no matter what equation/ size, the parentheses still touch the borders. – Karfloffel Aug 9 '16 at 14:49

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.