I am back again with my table.
I've added a tikz picture on the right side. I am quite happy with the result but I don't truly understand what I've done since I copied some code from here and tweaked it a little bit.
Here is the code:
\documentclass{letter}
\usepackage[a4paper, margin=15pt]{geometry}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\newlength{\Oldarrayrulewidth}
\newcommand{\Cline}[2]{%
\noalign{\global\setlength{\Oldarrayrulewidth}{\arrayrulewidth}}%
\noalign{\global\setlength{\arrayrulewidth}{#1}}\cline{#2}%
\noalign{\global\setlength{\arrayrulewidth}{\Oldarrayrulewidth}}}
\newcommand\VRule{\vrule width 2pt}
\newcommand\mottonScoreHeader[2]{%
\multicolumn{1}{|c}{\textbf{#2}} &
\multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{#1}}}
}
\newcommand\mottonScoreEmptyCells{%
& \multicolumn{1}{c!{\VRule}}{} & & & & & & & & & & & & & & &\\
}
\newcommand\mottonScoreBorder{%
\cline{4-4} \cline{7-7} \cline{10-10} \cline{13-13} \cline{16-16}
}
\newcommand\mottonScoreEmptyDoubleCells{%
\multicolumn{1}{|c}{} & \multicolumn{1}{|c|}{} & \multicolumn{1}{|c!{\VRule}}{} & & \multicolumn{2}{c!{\VRule}}{} & & \multicolumn{2}{c!{\VRule}}{} & & \multicolumn{2}{c!{\VRule}}{} & & \multicolumn{2}{c!{\VRule}}{} & & \multicolumn{2}{c!{\VRule}}{}\\
}
\newcommand\mottonScoreRow[2]{%
\mottonScoreHeader{#1}{#2}\mottonScoreEmptyCells\mottonScoreBorder\mottonScoreEmptyDoubleCells
}
\newcommand\mottonScore{%
\setlength{\extrarowheight}{2pt}
\begin{tabularx}{\textwidth}{ccp{15pt}|*{5}{p{8pt}|X@{+}p{15pt}!{\VRule}}}
\cline{4-18}
& & & \multicolumn{15}{c|}{\textbf{Joueurs}} \\ \cline{4-18}
& & \multicolumn{1}{c!{\VRule}}{} & \multicolumn{3}{c!{\VRule}}{} & \multicolumn{3}{c!{\VRule}}{} & \multicolumn{3}{c!{\VRule}}{} & \multicolumn{3}{c!{\VRule}}{} & \multicolumn{3}{c!{\VRule}}{} \\ \cline{1-18}
\mottonScoreRow{10}{\multirow{40}{*}{\rotatebox[origin=c]{90}{Cartes}}}\cline{2-18}
\mottonScoreRow{9}{}\cline{2-18}
\mottonScoreRow{8}{}\cline{2-18}
\mottonScoreRow{7}{}\cline{2-18}
\mottonScoreRow{6}{}\cline{2-18}
\mottonScoreRow{5}{}\cline{2-18}
\mottonScoreRow{4}{}\cline{2-18}
\mottonScoreRow{3}{}\cline{2-18}
\mottonScoreRow{2}{}\cline{2-18}
\mottonScoreRow{1}{}\Cline{2pt}{2-18}
\mottonScoreRow{1}{}\cline{2-18}
\mottonScoreRow{2}{}\cline{2-18}
\mottonScoreRow{3}{}\cline{2-18}
\mottonScoreRow{4}{}\cline{2-18}
\mottonScoreRow{5}{}\cline{2-18}
\mottonScoreRow{6}{}\cline{2-18}
\mottonScoreRow{7}{}\cline{2-18}
\mottonScoreRow{8}{}\cline{2-18}
\mottonScoreRow{9}{}\cline{2-18}
\mottonScoreRow{10}{}\cline{1-18}
\end{tabularx}
}
\newcommand\mottonDataHeader[2]{%
\multicolumn{1}{|c}{#2} & \multicolumn{1}{|c|}{\textbf{#1}}
}
\newcommand\mottonData{%
\setlength{\extrarowheight}{3pt}
\begin{tabular}{cc|*{11}{c|}}
\cline{3-13}
& & \multicolumn{11}{c|}{\textbf{Levées réalisées}} \\
\cline{3-13}
& & \textbf{0} & \textbf{1} & \textbf{2} & \textbf{3} & \textbf{4} & \textbf{5} & \textbf{6} & \textbf{7} & \textbf{8} & \textbf{9} & \textbf{10} \\
\cline{1-13}
\mottonDataHeader{10}{\multirow{10}{*}{\rotatebox[origin=c]{90}{\textbf{Cartes en main}}}}
& 10 & 11 & 14 & 19 & 26 & 35 & 46 & 59 & 74 & 91 & 110 \\
\cline{2-13}
\mottonDataHeader{9}{}
& 10 & 12 & 16 & 22 & 30 & 40 & 52 & 66 & 82 & 100 \\
\cline{2-12}
\mottonDataHeader{8}{}
& 10 & 13 & 18 & 25 & 34 & 45 & 58 & 73 & 90 \\
\cline{2-11}
\mottonDataHeader{7}{}
& 10 & 14 & 20 & 28 & 38 & 50 & 64 & 80 \\
\cline{2-10}
\mottonDataHeader{6}{}
& 10 & 15 & 22 & 31 & 42 & 55 & 70 \\
\cline{2-9}
\mottonDataHeader{5}{}
& 10 & 16 & 24 & 34 & 46 & 60 \\
\cline{2-8}
\mottonDataHeader{4}{}
& 10 & 17 & 26 & 37 & 50 \\
\cline{2-7}
\mottonDataHeader{3}{}
& 10 & 18 & 28 & 40 \\
\cline{2-6}
\mottonDataHeader{2}{}
& 10 & 19 & 30 \\
\cline{2-5}
\mottonDataHeader{1}{}
& 10 & 20 \\
\cline{1-4}
\end{tabular}
\mottonTitle
\[
score = (10 + lev\acute{e}es\ r\acute{e}alis\acute{e}es - cartes\ en\ main) \times lev\acute{e}es\ r\acute{e}alis\acute{e}es + 10
\]
}
\newcommand{\mottonTitle}[1][]{%
\begin{tikzpicture}[#1]
\node[text width=9cm,align=center](titre){\Huge Motton};
\node[text width=9cm,align=center] at ([yshift=-1cm]titre.north){Feuille de score};
\end{tikzpicture}
}
\begin{document}
\pagenumbering{gobble}
\mottonData
\mottonScore
\mottonData
\mottonScore
\end{document}
My questions are:
- Why my tikz picture is vertically aligned with the middle of the table? I was expecting it would be aligned from the top
- Why do I need to set the tikz picture width if I want to center it? Can't I just position the picture where I want?
It seems that there are some misunderstandings, so I'll try to add some clarifications. I am happy with what I've got. I just don't understand how I've got it.
From what I've coded, I thought the picture would be aligned on the top of the table. I was planning to move it down later. But it was already located where I wanted. That's the topic of the first question.
For the second question, if I don't set the width of the node, the node is on the left side, aligned to the edge of the table. My guess is because the node takes only the space needed to display the text contained. Am I right?
inner sep
of the node on each side, which is 0.333em by default. (Why would it the node take more space?)