# Diagonal cell division with tikz figure on same row and into X column from longtabu

MWE (with full package list)

\documentclass[english, bibliography=totoc]{scrreprt}

%%% PAGE DIMENSIONS
\usepackage{geometry}

%%% PACKAGES
\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
\usepackage{amsmath, amsthm, amssymb, url}
\usepackage{enumitem}
\usepackage{mathrsfs}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{tabu,longtable,booktabs,caption}
\usepackage[pdftex]{graphicx,color}
\usepackage{scrpage2,datetime,tikz}
\usepackage[unicode=true]{hyperref}
\usepackage[numbered]{bookmark}
\usepackage{makecell}

%%% OPTIONS
\bibliographystyle{plain}
\setcounter{secnumdepth}{3}
\setlength{\parindent}{1em}
%\setlist{nolistsep}
\tabulinesep=^1.5mm_1.5mm
\tikzset{>=latex}
\hypersetup{
citecolor=black,
filecolor=black,
urlcolor=black
}

%%% DEFINITIONS
\newenvironment{myfont}{\fontfamily{phv}\selectfont}{\par}
\renewcommand{\dateseparator}{.}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\Wrap}{Wrap}

\begin{document}

{\centering
\begin{longtabu} to \linewidth {|[1.5pt] X[1,m,c] |[1.5pt] >{\centering\arraybackslash}m{5cm} |[1.5pt] >{\centering\arraybackslash}m{5cm} |[1.5pt]}

\tabucline[1.5pt]{-} \multicolumn{3}{|[1.5pt]c|[1.5pt]}{{Continued on next page}} \\ \tabucline[1.5pt]{-} \endfoot

\endlastfoot

& \begin{tikzpicture} \draw [->] (0,0) arc [radius=0.5, start angle=180, end angle= -90]; \draw [->] (2,0) arc [radius=0.5, start angle=180, end angle= -90];   \end{tikzpicture}
& \begin{tikzpicture} \draw [->] (0,0) arc [radius=0.5, start angle=180, end angle= -90]; \draw [->] (2.5,-0.5) arc [radius=0.5, start angle=-90, end angle= 180];   \end{tikzpicture} \\ \tabucline[1.5pt]{-}

& & \\ \tabucline[1.5pt]{-}

\end{longtabu}}

\end{document}


I end up having:

My problems with it are:

• the diagonal line is too thin
• the diagonal line does not touch the corners of the cell

Anyone has suggestions on how to achieve what I would like? I already checked here and that's how I found the makecell package and \diaghead, but with poor results, as you can see.

Based in my answer to another question, I had to adapt it here to the longtabu environment.

For this case, there is no need to specify the width of the diagonal cell, because it is pre-computed by tabu. Only the vertical size is neccessary.

\newcommand\diag[4][line cap=round, line width=1.5pt]{%
% #1 diagonal line style (optional), #2 vertical size of the cell, #3 and #4 labels
$\vcenter{\begin{tikzpicture}[baseline=0,anchor=south west,inner sep=1pt] \path[use as bounding box] (0,0) rectangle (\linewidth,#2); \node[minimum width=\linewidth, minimum height=#2] (box) {}; \draw[#1] (box.north west) -- (box.south east); \node[anchor=south west] at (box.south west) {#3}; \node[anchor=north east] at (box.north east) {#4}; \end{tikzpicture}}$}


\diaghead{\hskip\hsize}{Relative Distance}{Turn Direction}


to

\diag{1.2cm}{Relative Distance}{Turn Direction}


to get this:

Of course you can try different vertical sizes and even change the style of the diagonal, via a first optional parameter:

\diag[thick, gray]{1.2cm}{Relative Distance}{Turn Direction}%


As you can see, the diagonal does not reach the corners of the cell. This is because tabu always add a padding around the cell contents, and I was unable to find the name of the variables which store those dimensions. However, it does not look so bad currently.

• thank you! I will test your solution as soon as I get back to the office. I will accept the answer as soon as I can check it. – Federico Nov 15 '13 at 18:34
• also, might be that the padding is related to this line: \tabulinesep=^1.5mm_1.5mm – Federico Nov 15 '13 at 18:37