Column headings on the table border
- Typeset the table normally, including the headers.
- Add
\tikznode
commands for each header 'on the line'. - Wrap the whole
tabular
into a\tikznode
command. - Add a
tikzpicture
to draw the lines.
The \tikznode
command is defined and described in this answer to "How to add arrow in equations and matrix".
For fine-tuning, use the optional argument of \tikznode
to supply options to tikz. E.g., for adding more space around the tabular and the headers, you can define two styles by
\tikzset{tab/.style={inner sep=2pt},hdr/.style={inner xsep=4pt}}
and add tab
and hdr
as options to the \tikznode
commands.
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\newcommand\tikznode[3][]{%
\tikz[remember picture,baseline=(#2.base)]
\node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
}
\tikzset{tab/.style={inner sep=2pt},hdr/.style={inner xsep=4pt}}
\begin{document}
\tikznode[tab]{singplu}{%
\begin{tabular}{llll|lll}
\multicolumn{4}{c}{\tikznode[hdr]{sing}{SINGULIER}} & \multicolumn{3}{c}{\tikznode[hdr]{plu}{PLURIEL}} \\
& & & & & \\
& MASCULIN & FÉMININ & NEUTRE & MASCULIN & FÉMININ & NEUTRE \\
\textsc{Nom.} & \emph{is} & \emph{ea} & \emph{id} & \emph{ei} ou \emph{ii} & \emph{eæ} & \emph{ea}
\end{tabular}%
}%
\begin{tikzpicture}[remember picture,overlay]
\draw (singplu.south west) |- (sing);
\draw (sing) -- (plu);
\draw (plu) -| (singplu.south east);
\draw (singplu.south east) -- (singplu.south west);
\end{tikzpicture}
\end{document}
Here is a solution with {NiceTabular}
of nicematrix
.
\documentclass{article}
\usepackage[french]{babel}
\usepackage{lmodern}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
\newcolumntype{:}{!{\vrule}}
\begin{NiceTabular}{|llll:lll|}
\Hline
\noalign{\vspace{4mm}}
& MASCULIN & FÉMININ & NEUTRE & MASCULIN & FÉMININ & NEUTRE \\
\textsc{Nom.} & \emph{is} & \emph{ea} & \emph{id} & \emph{ei} ou \emph{ii} & \emph{eæ} & \emph{ea} \\
\noalign{\vspace{1mm}}
\Hline
\CodeAfter
\tikz
\draw (row-1-|col-1) -- node [fill=white] {SINGULIER} (row-1-|col-5)
(row-1-|col-5) -- node [fill=white] {PLURIEL} (row-1-|col-8) ;
\end{NiceTabular}%
\end{document}
You need several compilations (because nicematrix
uses PGF/Tikz nodes).