1

I was looking for way to create custom table-ish diagram and found this old question: Creating a table with axes

I am using fithesis package and template from my university and solution from one answer changed to my requirements.

\usetikzlibrary{matrix}

\begin{table}
    
    \caption{Typy uživatelského rozhraní v herním průmyslu.}
    
    \begin{tikzpicture}
        \matrix (T) [matrix of nodes,nodes={draw,text width=3cm,align=center,minimum height=2.5cm,inner sep=1pt,font=\footnotesize,anchor=south}]
        {
            Diegetic & Spatial \\
            Meta & Non-Diegetic \\
        };
        
        \node[yshift=12mm,font=\bfseries] at (T.north){Je součástí narativu?};
        
    *   \node[xshift=-16mm,font=\bfseries,rotate=90] at (T.west){Je v prostoru herní scény?};
        
        \matrix at (T.north west) [matrix of nodes,anchor=south west,yshift=-4mm,column sep=4pt,nodes={text width=3cm,align=center,minimum height=1.3cm,inner sep=1pt,font=\bfseries}]
    *   {
            Ano & Ne\\
        };
        
        \matrix at (T.north west) [matrix of nodes,anchor=north east,row sep=4pt,nodes={text width=2.3cm,align=right,minimum height=2.5cm,font=\bfseries}]
        {
            Ano\\
            Ne\\
        };
    \end{tikzpicture}
\end{table}

Code above is in separate file (except \usetikzlibrary{matrix}, which is in main file under \usepackage{tikz}). I insert this separate file into main file using \input{}

Everything renders fine but on lines marked with "*" (* are not in real code, just visualization of error lines) I am getting error Missing number, treated as zero and it cause crash of printing.

When I try this code in clear tex file, everything is OK so I expect some incompatibility between this code and fithesis but I have no idea what could be problem. Thanks for any help.

3
  • 1
    Welcome to ZrX.SE! In your code you have asterixis (*) which cause errors. Remove them. Your other problems are not clear. Including this (corrected) code by input directive should not be a problem. – Zarko Feb 28 at 16:49
  • If you are talking about same (*) as I, then I have written, that they are there just to mark the rows, where errors occurs. I maybe wasn't clear enough about that they are only markings. – Marek Bařinka Feb 28 at 18:37
  • Meanwhile I wrote an answer (based on guessing, what is your problem). See, if it can help you, if not, than you need to rephrase your question. As it is now, is unclear. – Zarko Feb 28 at 18:41
1

See, if the following work around can help you.

Main file:

\documentclass{book}
\usepackage{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix, 
                positioning}
\usepackage{caption}
\usepackage{lipsum}

\begin{document}
\lipsum[11]

    \begin{table}[ht]
    \centering
\caption{Typy uživatelského rozhraní v herním průmyslu.}
\label{tab:typy-rozhrani.tex}
\input{tab-typy-rozhrani.tex}
    \end{table}
\lipsum[12]
\end{document}

file with table, its name lets be tab-typy-rozhrani.tex:

% file: tab-typy-rozhrani.tex
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix,
                positioning}

\begin{document}
    \begin{tikzpicture}[
node distance = 3mm and 3mm,
   lbl/.style = {rotate=#1, anchor=south, inner sep=1pt, font=\bfseries}
                        ]
\matrix (T) [matrix of nodes,
             nodes={draw, minimum width=3cm, align=center, minimum height=24mm,
                    font=\footnotesize, outer sep=0pt, anchor=south},
             column sep=-\pgflinewidth,
             row sep=-\pgflinewidth,
             column 1/.append style = {nodes={minimum width=2em, draw=none, font=\bfseries}},
             row 1/.append style    = {nodes={minimum height=1.2em, draw=none, font=\bfseries}}
             ]
{
    &   Ano         &   Ne              \\
Ano &   Diegetic    &   Spatial         \\
Ne  &   Meta        &   Non-Diegetic    \\
};
\node[above=of T, lbl= 0] {Je součástí narativu?};
\node[left =of T, lbl=90, xshift=-1ex] {Je v prostoru herní scény?};
    \end{tikzpicture}
\end{document}

(table code is a bit changed/simplified)

Result of main file:

enter image description here

3
  • Tried it, hopefully with correct inputting to my project, still same errors, just different places. Firste on line with top & Ano & Ne, second on line containing last node – Marek Bařinka Feb 28 at 18:41
  • Your comment is not helpful. Suggested solution is tested and it works. Sorry, but we don't know, how you tested proposed solution. – Zarko Feb 28 at 18:43
  • I put your solution to university template wich should primarily use fithesis package (mainly configuration) on Overleaf. Here is address: overleaf.com/3939494445vkxtcjpgtwhn I am getting same errors in my little more complex project. Sorry that my question was not clear enough. – Marek Bařinka Feb 28 at 18:58
1

After some digging (enabling and disabling packages) I found that problem was with package babel, solved using \usetikzlibrary{babel}. Not sure what exactly was the problem, but this worked for me.

Not the answer you're looking for? Browse other questions tagged or ask your own question.