I am using tabu package to easily typeset my tables. So, there are few problems that i have solved:

  • vertical spacing (from cell content to borders) is less than line height and line depth, so i use \struts before and after content;
  • LaTeX does not break line at the beginning, so i use \hspace{0pt} at the very beginning of cell content to make LaTeX break line and add hyphenation;
  • LaTeX does not hyphenate words with macro, so i have to add \hspace{0pt} between end of cell content and \strut.

Column spec looks like:

\begin{tabu} to \linewidth {|>{\strut\hspace{0pt}}X[0.4,L]<{\hspace{0pt}\strut}|%

How can i declare a new column type (for example, Y) with these features using X type? Like this (but this does not work):

\tabucolumn Y
  • Add \nolinebreak before \hspace{0pt}\strut in the "end part" or you'll get an empty line in many occasions. – egreg Oct 17 '13 at 10:34

Your way of defining a new column type is not incorrect. But I guess you miss the possibility of passing arguments to the X specifier. This can be done as follows with a format requiring an argument:

Sample output


\tabucolumn Y

\begin{tabu} to \linewidth{Y{.5,C} Y{.5}}
  Text text and longer words with extra line&  Text text
  and longer words with indisputably elegant hyphenation algorithm\\
| improve this answer | |

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.