Skip to main content
Some typos and grammar corrected. More explanation.
Source Link
Sveinung
  • 20.8k
  • 2
  • 54
  • 76

Here are your both of your tables layouttypeset as calstables, i.e. typeset using the package cals. I have also typeset onethe first table using tabularxtabularx, hhlinehhline, arrayarray and multirowmultirow. I used tabularxtabularx, because that package can calculate column width taking into consideration all the necessary variables.

calstable has no support for double rules (bordersdouble borders), so I have faked such rules using narrow rows and columns.

Since I have typeset both your tables in the same document. Therefore, I moved the table setup commands and the definition off shortcuts from the table preamble to the document preamble. I have tweaked all rules (lines), ensuring that no single rules are cutting double double rules. Therefore, you will see the shortcut \lb, \rb used several places, to switch off remove and switch on rules for individual cells. How the double vertical rules shall connect to double horizontal rules depends on local typographical traditions, so it isI do not guaranteedguarantee that what I have chosenmay choice is correct in your jurisdiction.

I filled in some cell content to typeset the table with correct row height, and as consequence, I increase the high rowsrow heights in the firsfirst table to 2two baselineskip\baselineskips, compared to previous example. In addition, I vertically centred the cell content in all cells by using thea documented hook, see the command \def\cals@AtBeginCell{\vfil}:

Here is your first table typeset with tabularxtabularx and friends. As you will see, the setup and definition of columns and column width are pretty complicated. To have correct connecting rules, I used the hhlinehhline package.

\documentclass{article} \usepackage{array, tabularx, multirow, hhline} % Two shorthands to secured equal rowhighrowheigth \newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}} \newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}} % Define four new X column types based on width. tabularx takes care of the mathmaths involved \newcolumntype{A}{>{\centering\arraybackslash\hsize=0.4\hsize\linewidth=\hsize}X} \newcolumntype{B}{>{\centering\arraybackslash\hsize=0.3\hsize\linewidth=\hsize}X} \newcolumntype{C}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize}X} \newcolumntype{D}{>{\centering\arraybackslash\hsize=0.1\hsize\linewidth=\hsize}X} % Uncomment to see margins etc. %\usepackage{showframe} %\renewcommand*\ShowFrameColor{\color{red}} %\renewcommand*\ShowFrameLinethickness{.15pt} \setlength{\tabcolsep}{0.5em} \setlength{\extrarowheight}{4pt} % Push first line of text away from rules above. \begin{document} \centering \begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|} \hhline{|*{9}{=}|} \hz B & \multicolumn{4}{c||}{} & \multicolumn{4}{c|}{}\\ \hhline{|-||----||----|} \hz B & \multicolumn{2}{c|}{} & & & \multicolumn{2}{c|}{} & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{\centering B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz \hz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|*{9}{=}|} \end{tabularx} \end{document} 

Here are your both tables layout as calstables, i.e. typeset using the package cals. I have also typeset one using tabularx, hhline, array and multirow. I used tabularx, because that package can calculate column width taking into consideration all variables.

calstable has no support for double rules (borders), so I have faked such rules using narrow rows and columns.

I have typeset both your tables in the same document. Therefore, I moved the setup commands and the definition off shortcuts from the table preamble to the document preamble. I have tweaked all rules (lines), ensuring that no single rules are cutting double double rules. How the double vertical rules shall connect to double horizontal rules depends on local typographical traditions, so it is not guaranteed that what I have chosen is correct in your jurisdiction.

I filled in some cell content to typeset the table with correct row height, and as consequence, I increase the high rows in the firs table to 2 baselineskips. In addition, I vertically centred the cell content in all cells by using the documented hook, see the command \def\cals@AtBeginCell{\vfil}:

Here is your first table typeset with tabularx and friends. As you will see, the setup and definition of columns and column width are pretty complicated. To have correct connecting rules I used the hhline package.

\documentclass{article} \usepackage{array, tabularx, multirow, hhline} % Two shorthands to secured equal rowhigh \newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}} \newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}} % Define four new X column types based on width. tabularx takes care of the math involved \newcolumntype{A}{>{\centering\arraybackslash\hsize=0.4\hsize\linewidth=\hsize}X} \newcolumntype{B}{>{\centering\arraybackslash\hsize=0.3\hsize\linewidth=\hsize}X} \newcolumntype{C}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize}X} \newcolumntype{D}{>{\centering\arraybackslash\hsize=0.1\hsize\linewidth=\hsize}X} % Uncomment to see margins etc. %\usepackage{showframe} %\renewcommand*\ShowFrameColor{\color{red}} %\renewcommand*\ShowFrameLinethickness{.15pt} \setlength{\tabcolsep}{0.5em} \setlength{\extrarowheight}{4pt} % Push first line of text away from rules above. \begin{document} \centering \begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|} \hhline{|*{9}{=}|} \hz B & \multicolumn{4}{c||}{} & \multicolumn{4}{c|}{}\\ \hhline{|-||----||----|} \hz B & \multicolumn{2}{c|}{} & & & \multicolumn{2}{c|}{} & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{\centering B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz \hz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|*{9}{=}|} \end{tabularx} \end{document} 

Here are both of your tables typeset as calstables, i.e. using the package cals. I have also typeset the first table using tabularx, hhline, array and multirow. I used tabularx, because that package can calculate column width taking into consideration all the necessary variables.

calstable has no support for double rules (double borders), so I have faked such rules using narrow rows and columns.

Since I typeset both tables in the same document, I moved the table setup commands and the definition off shortcuts from the table preamble to the document preamble. I have tweaked all rules (lines), ensuring that no single rules are cutting double double rules. Therefore, you will see the shortcut \lb, \rb used several places, to switch off remove and switch on rules for individual cells. How the double vertical rules shall connect to double horizontal rules depends on local typographical traditions, so I do not guarantee that may choice is correct in your jurisdiction.

I filled in some cell content to typeset the table with correct row height, and as consequence, I increase the row heights in the first table to two \baselineskips, compared to previous example. In addition, I vertically centred the cell content in all cells by using a documented hook, see the command \def\cals@AtBeginCell{\vfil}:

Here is your first table typeset with tabularx and friends. As you will see, the setup and definition of columns and column width are pretty complicated. To have correct connecting rules, I used the hhline package.

\documentclass{article} \usepackage{array, tabularx, multirow, hhline} % Two shorthands to secured equal rowheigth \newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}} \newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}} % Define four new X column types based on width. tabularx takes care of the maths involved \newcolumntype{A}{>{\centering\arraybackslash\hsize=0.4\hsize\linewidth=\hsize}X} \newcolumntype{B}{>{\centering\arraybackslash\hsize=0.3\hsize\linewidth=\hsize}X} \newcolumntype{C}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize}X} \newcolumntype{D}{>{\centering\arraybackslash\hsize=0.1\hsize\linewidth=\hsize}X} % Uncomment to see margins etc. %\usepackage{showframe} %\renewcommand*\ShowFrameColor{\color{red}} %\renewcommand*\ShowFrameLinethickness{.15pt} \setlength{\tabcolsep}{0.5em} \setlength{\extrarowheight}{4pt} % Push first line of text away from rules above. \begin{document} \centering \begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|} \hhline{|*{9}{=}|} \hz B & \multicolumn{4}{c||}{} & \multicolumn{4}{c|}{}\\ \hhline{|-||----||----|} \hz B & \multicolumn{2}{c|}{} & & & \multicolumn{2}{c|}{} & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{\centering B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz \hz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|*{9}{=}|} \end{tabularx} \end{document} 
Corrected wrong calculation of column width for tabularx
Source Link
Sveinung
  • 20.8k
  • 2
  • 54
  • 76
\documentclass{article} \usepackage{array, tabularx, multirow, hhline} % Two shorthands to secured equal rowhigh \newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}} \newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}} % Define four new X column types based on width. tabularx takes care of the math involved \newcolumntype{A}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize4\hsize\linewidth=\hsize}X} \newcolumntype{B}{>{\centering\arraybackslash\hsize=0.17\hsize\linewidth=\hsize3\hsize\linewidth=\hsize}X} \newcolumntype{C}{>{\centering\arraybackslash\hsize=0.11\hsize\linewidth=\hsize2\hsize\linewidth=\hsize}X} \newcolumntype{D}{>{\centering\arraybackslash\hsize=0.05\hsize\linewidth=\hsize1\hsize\linewidth=\hsize}X} % Uncomment to see margins etc. %\usepackage{showframe} %\renewcommand*\ShowFrameColor{\color{red}} %\renewcommand*\ShowFrameLinethickness{.15pt} \setlength{\tabcolsep}{0.5em} \setlength{\extrarowheight}{4pt} % Push first line of text away from rules above. \begin{document} \centering \begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|} \hhline{|*{9}{=}|} \hz B & \multicolumn{4}{c||}{} & \multicolumn{4}{c|}{}\\ \hhline{|-||----||----|} \hz B & \multicolumn{2}{c|}{} & & & \multicolumn{2}{c|}{} & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{\centering B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz \hz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|*{9}{=}|} \end{tabularx} \end{document} 
\documentclass{article} \usepackage{array, tabularx, multirow, hhline} % Two shorthands to secured equal rowhigh \newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}} \newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}} % Define four new X column types based on width. tabularx takes care of the math involved \newcolumntype{A}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize}X} \newcolumntype{B}{>{\centering\arraybackslash\hsize=0.17\hsize\linewidth=\hsize}X} \newcolumntype{C}{>{\centering\arraybackslash\hsize=0.11\hsize\linewidth=\hsize}X} \newcolumntype{D}{>{\centering\arraybackslash\hsize=0.05\hsize\linewidth=\hsize}X} % Uncomment to see margins etc. %\usepackage{showframe} %\renewcommand*\ShowFrameColor{\color{red}} %\renewcommand*\ShowFrameLinethickness{.15pt} \setlength{\tabcolsep}{0.5em} \setlength{\extrarowheight}{4pt} % Push first line of text away from rules above. \begin{document} \centering \begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|} \hhline{|*{9}{=}|} \hz B & \multicolumn{4}{c||}{} & \multicolumn{4}{c|}{}\\ \hhline{|-||----||----|} \hz B & \multicolumn{2}{c|}{} & & & \multicolumn{2}{c|}{} & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{\centering B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz \hz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|*{9}{=}|} \end{tabularx} \end{document} 
\documentclass{article} \usepackage{array, tabularx, multirow, hhline} % Two shorthands to secured equal rowhigh \newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}} \newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}} % Define four new X column types based on width. tabularx takes care of the math involved \newcolumntype{A}{>{\centering\arraybackslash\hsize=0.4\hsize\linewidth=\hsize}X} \newcolumntype{B}{>{\centering\arraybackslash\hsize=0.3\hsize\linewidth=\hsize}X} \newcolumntype{C}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize}X} \newcolumntype{D}{>{\centering\arraybackslash\hsize=0.1\hsize\linewidth=\hsize}X} % Uncomment to see margins etc. %\usepackage{showframe} %\renewcommand*\ShowFrameColor{\color{red}} %\renewcommand*\ShowFrameLinethickness{.15pt} \setlength{\tabcolsep}{0.5em} \setlength{\extrarowheight}{4pt} % Push first line of text away from rules above. \begin{document} \centering \begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|} \hhline{|*{9}{=}|} \hz B & \multicolumn{4}{c||}{} & \multicolumn{4}{c|}{}\\ \hhline{|-||----||----|} \hz B & \multicolumn{2}{c|}{} & & & \multicolumn{2}{c|}{} & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{\centering B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz \hz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|*{9}{=}|} \end{tabularx} \end{document} 
Added tabularx table
Source Link
Sveinung
  • 20.8k
  • 2
  • 54
  • 76

NB!calstable and tabularx table There was spanning error in the first version, wrong cells was spanned in the first column. I have updated the code once more to correct the horizontal rules where they are crossing the double vertical rules.

Here are your both tables layout as calstables, i.e. typeset using the package cals. I have also typeset one using tabularx, hhline, array and multirow. I used tabularx, because that package can calculate column width taking into consideration all variables.

calstable

calstable has no support for double rules (borders), so I have faked such rules using narrow rows and columns.

In this version I have typeset both your tables in the same document. Therefore, so I moved the setup of the tablescommands and the definition off shortcuts from the table preamble to the document preamble. I have tweaked theall rules (lines), ensuring that no single rules are cutting double linesdouble rules. How the double vertical rules shall cross,connect to double horizontal rules depends on local typographical traditions, so it is not guaranteed that no cutting at allwhat I have chosen is correct for youin your jurisdiction.

\documentclass{article} \usepackage{cals} % Set up the carlstable \makeatletter %% All rules of same weight \def\cals@framers@width{0.3pt} % Outside frame rules, reduce if the rule is too heavy \def\cals@framecs@width{0.3pt} \def\cals@bodyrs@width{0.3pt} \def\cals@cs@width{0.3pt} % Inside rules, reduce if the rule is too heavy \def\cals@rs@width{0.3pt} \def\cals@AtBeginCell{\vfil} % All cell contents vertically centred % Shorthands for spanning cells, table rules and the spece between columns and rows (padding) \let\nc=\nullcell \let\sc=\spancontent \def\rb{\ifx\cals@borderR\relax % Right Border (rules) switch (off-on) \def\cals@borderR{0.0pt} \else \let\cals@borderR\relax\fi} \def\lb{\ifx\cals@borderL\relax % Left Border switch (off-on) \def\cals@borderL{0.0pt} \else \let\cals@borderL\relax\fi} \def\bb{\ifx\cals@borderB\relax % Bottom Border switch (off-on) \def\cals@borderB{0.0pt} \else \let\cals@borderB\relax\fi} \def\tp{\ifdim\cals@paddingT=0.0pt\relax % Top padding switch (off-on) \cals@setpadding{Ag} \else \setlength{\cals@paddingT}{0pt}\fi} \def\bp{\ifdim\cals@paddingB=0.0pt\relax % Bottom padding switch (off-on) \cals@setpadding{Ag} \else \setlength{\cals@paddingB}{0pt}\fi} \makeatother \begin{document} \begin{calstable}[c] % Defining 11 columns, 2 are for double vertical rules (col2 and col7) \colwidths{{\dimexpr(\columnwidth/21*3)} {2pt} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*1)} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*4)} {2pt} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*1)} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*4)} } \makeatletter % R1H1 % This first row is just to ‘fake’ double horizontal lines \thead{% \brow \rb\tp\cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{}\rb \cell{}\tp \ht\cals@current@row=2pt \erow % %R2H2 % Header \brow \alignC\cell{C} \bb\cell{}\bb \nc{ltb} \nc{tb} \nc{tb} \nc{rtb}\sc{} \bb\cell{}\bb \nc{ltb} \nc{tb} \nc{tb} \nc{rtb}\sc{} \erow } \tfoot{\lastrule\strut} %R3B1 \brow \cell{C} \bb\cell{}\bb \nc{ltb} \nc{rtb}\sc{} \cell{} \cell{} \bb\cell{}\bb \nc{ltb} \nc{rtb}\sc{} \cell{} \cell{} \erow %R4B2 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R5B3 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R6B4 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R7B5 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R8B6 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R9B7 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R10B9 % This last row is just to ‘fake’ double horizontal lines \brow \rb\bp\cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{}\rb \cell{}\bp \ht\cals@current@row=2pt \erow \makeatletter \end{calstable}\par \vspace{1cm} \begin{calstable}[l] % Defining 5 columns, 1 are for double vertical rules (col2) \colwidths{{\dimexpr(\columnwidth/15*3)} {2pt} {\dimexpr(\columnwidth/15*2)} {\dimexpr(\columnwidth/15*1)} {\dimexpr(\columnwidth/15*3)} } \makeatletter % R1H1 % This first row is just to ‘fake’ double horizontal lines \thead{% \brow \rb\tp\cell{} \bb\cell{}\bb \cell{} \cell{} \cell{}\rb\tp \ht\cals@current@row=2pt \erow % %R2H2 % Header \brow \alignC\cell{C} \bb\cell{}\bb \cell{} \cell{} \cell{} \erow } \tfoot{\lastrule\strut} %R4B2 \brow \bb\cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R5B3 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R6B4 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R7B5 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R8B6 \brow \bb\cell{C}\bb \cell{} \bb\cell{} \cell{} \cell{}\bb \erow %R10B9 % This last row is just to ‘fake’ double horizontal lines \brow \bb\rb\bp\cell{} \cell{} \cell{} \cell{}\rb \cell{}\bb \ht\cals@current@row=2pt \erow \makeatletter \end{calstable}\par \end{document} 

tabularx and friends

Here is your first table typeset with tabularx and friends. As you will see, the setup and definition of columns and column width are pretty complicated. To have correct connecting rules I used the hhline package.

enter image description here

\documentclass{article} \usepackage{array, tabularx, multirow, hhline} % Two shorthands to secured equal rowhigh \newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}} \newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}} % Define four new X column types based on width. tabularx takes care of the math involved \newcolumntype{A}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize}X} \newcolumntype{B}{>{\centering\arraybackslash\hsize=0.17\hsize\linewidth=\hsize}X} \newcolumntype{C}{>{\centering\arraybackslash\hsize=0.11\hsize\linewidth=\hsize}X} \newcolumntype{D}{>{\centering\arraybackslash\hsize=0.05\hsize\linewidth=\hsize}X} % Uncomment to see margins etc. %\usepackage{showframe} %\renewcommand*\ShowFrameColor{\color{red}} %\renewcommand*\ShowFrameLinethickness{.15pt} \setlength{\tabcolsep}{0.5em} \setlength{\extrarowheight}{4pt} % Push first line of text away from rules above. \begin{document} \centering \begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|} \hhline{|*{9}{=}|} \hz B & \multicolumn{4}{c||}{} & \multicolumn{4}{c|}{}\\ \hhline{|-||----||----|} \hz B & \multicolumn{2}{c|}{} & & & \multicolumn{2}{c|}{} & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{\centering B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz \hz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|*{9}{=}|} \end{tabularx} \end{document} 

NB! There was spanning error in the first version, wrong cells was spanned in the first column. I have updated the code once more to correct the horizontal rules where they are crossing the double vertical rules.

Here are your both tables layout as calstables, i.e. typeset using the package cals. calstable has no support for double rules (borders), so I have faked such rules using narrow rows and columns.

In this version I have typeset both tables in the same document, so I moved the setup of the tables and the definition off shortcuts from the table preamble to the document preamble. I have tweaked the rules, ensuring that no single rules are cutting double lines. How the double rules shall cross, depends on local typographical traditions, so it is not guaranteed that no cutting at all is correct for you.

\documentclass{article} \usepackage{cals} % Set up the carlstable \makeatletter %% All rules of same weight \def\cals@framers@width{0.3pt} % Outside frame rules, reduce if the rule is too heavy \def\cals@framecs@width{0.3pt} \def\cals@bodyrs@width{0.3pt} \def\cals@cs@width{0.3pt} % Inside rules, reduce if the rule is too heavy \def\cals@rs@width{0.3pt} \def\cals@AtBeginCell{\vfil} % All cell contents vertically centred % Shorthands for spanning cells, table rules and the spece between columns and rows (padding) \let\nc=\nullcell \let\sc=\spancontent \def\rb{\ifx\cals@borderR\relax % Right Border (rules) switch (off-on) \def\cals@borderR{0.0pt} \else \let\cals@borderR\relax\fi} \def\lb{\ifx\cals@borderL\relax % Left Border switch (off-on) \def\cals@borderL{0.0pt} \else \let\cals@borderL\relax\fi} \def\bb{\ifx\cals@borderB\relax % Bottom Border switch (off-on) \def\cals@borderB{0.0pt} \else \let\cals@borderB\relax\fi} \def\tp{\ifdim\cals@paddingT=0.0pt\relax % Top padding switch (off-on) \cals@setpadding{Ag} \else \setlength{\cals@paddingT}{0pt}\fi} \def\bp{\ifdim\cals@paddingB=0.0pt\relax % Bottom padding switch (off-on) \cals@setpadding{Ag} \else \setlength{\cals@paddingB}{0pt}\fi} \makeatother \begin{document} \begin{calstable}[c] % Defining 11 columns, 2 are for double vertical rules (col2 and col7) \colwidths{{\dimexpr(\columnwidth/21*3)} {2pt} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*1)} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*4)} {2pt} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*1)} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*4)} } \makeatletter % R1H1 % This first row is just to ‘fake’ double horizontal lines \thead{% \brow \rb\tp\cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{}\rb \cell{}\tp \ht\cals@current@row=2pt \erow % %R2H2 % Header \brow \alignC\cell{C} \bb\cell{}\bb \nc{ltb} \nc{tb} \nc{tb} \nc{rtb}\sc{} \bb\cell{}\bb \nc{ltb} \nc{tb} \nc{tb} \nc{rtb}\sc{} \erow } \tfoot{\lastrule\strut} %R3B1 \brow \cell{C} \bb\cell{}\bb \nc{ltb} \nc{rtb}\sc{} \cell{} \cell{} \bb\cell{}\bb \nc{ltb} \nc{rtb}\sc{} \cell{} \cell{} \erow %R4B2 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R5B3 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R6B4 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R7B5 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R8B6 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R9B7 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R10B9 % This last row is just to ‘fake’ double horizontal lines \brow \rb\bp\cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{}\rb \cell{}\bp \ht\cals@current@row=2pt \erow \makeatletter \end{calstable}\par \vspace{1cm} \begin{calstable}[l] % Defining 5 columns, 1 are for double vertical rules (col2) \colwidths{{\dimexpr(\columnwidth/15*3)} {2pt} {\dimexpr(\columnwidth/15*2)} {\dimexpr(\columnwidth/15*1)} {\dimexpr(\columnwidth/15*3)} } \makeatletter % R1H1 % This first row is just to ‘fake’ double horizontal lines \thead{% \brow \rb\tp\cell{} \bb\cell{}\bb \cell{} \cell{} \cell{}\rb\tp \ht\cals@current@row=2pt \erow % %R2H2 % Header \brow \alignC\cell{C} \bb\cell{}\bb \cell{} \cell{} \cell{} \erow } \tfoot{\lastrule\strut} %R4B2 \brow \bb\cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R5B3 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R6B4 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R7B5 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R8B6 \brow \bb\cell{C}\bb \cell{} \bb\cell{} \cell{} \cell{}\bb \erow %R10B9 % This last row is just to ‘fake’ double horizontal lines \brow \bb\rb\bp\cell{} \cell{} \cell{} \cell{}\rb \cell{}\bb \ht\cals@current@row=2pt \erow \makeatletter \end{calstable}\par \end{document} 

calstable and tabularx table

Here are your both tables layout as calstables, i.e. typeset using the package cals. I have also typeset one using tabularx, hhline, array and multirow. I used tabularx, because that package can calculate column width taking into consideration all variables.

calstable

calstable has no support for double rules (borders), so I have faked such rules using narrow rows and columns.

I have typeset both your tables in the same document. Therefore, I moved the setup commands and the definition off shortcuts from the table preamble to the document preamble. I have tweaked all rules (lines), ensuring that no single rules are cutting double double rules. How the double vertical rules shall connect to double horizontal rules depends on local typographical traditions, so it is not guaranteed that what I have chosen is correct in your jurisdiction.

\documentclass{article} \usepackage{cals} % Set up the carlstable \makeatletter %% All rules of same weight \def\cals@framers@width{0.3pt} % Outside frame rules, reduce if the rule is too heavy \def\cals@framecs@width{0.3pt} \def\cals@bodyrs@width{0.3pt} \def\cals@cs@width{0.3pt} % Inside rules, reduce if the rule is too heavy \def\cals@rs@width{0.3pt} \def\cals@AtBeginCell{\vfil} % All cell contents vertically centred % Shorthands for spanning cells, table rules and the spece between columns and rows (padding) \let\nc=\nullcell \let\sc=\spancontent \def\rb{\ifx\cals@borderR\relax % Right Border (rules) switch (off-on) \def\cals@borderR{0.0pt} \else \let\cals@borderR\relax\fi} \def\lb{\ifx\cals@borderL\relax % Left Border switch (off-on) \def\cals@borderL{0.0pt} \else \let\cals@borderL\relax\fi} \def\bb{\ifx\cals@borderB\relax % Bottom Border switch (off-on) \def\cals@borderB{0.0pt} \else \let\cals@borderB\relax\fi} \def\tp{\ifdim\cals@paddingT=0.0pt\relax % Top padding switch (off-on) \cals@setpadding{Ag} \else \setlength{\cals@paddingT}{0pt}\fi} \def\bp{\ifdim\cals@paddingB=0.0pt\relax % Bottom padding switch (off-on) \cals@setpadding{Ag} \else \setlength{\cals@paddingB}{0pt}\fi} \makeatother \begin{document} \begin{calstable}[c] % Defining 11 columns, 2 are for double vertical rules (col2 and col7) \colwidths{{\dimexpr(\columnwidth/21*3)} {2pt} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*1)} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*4)} {2pt} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*1)} {\dimexpr(\columnwidth/21*2)} {\dimexpr(\columnwidth/21*4)} } \makeatletter % R1H1 % This first row is just to ‘fake’ double horizontal lines \thead{% \brow \rb\tp\cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{}\rb \cell{}\tp \ht\cals@current@row=2pt \erow % %R2H2 % Header \brow \alignC\cell{C} \bb\cell{}\bb \nc{ltb} \nc{tb} \nc{tb} \nc{rtb}\sc{} \bb\cell{}\bb \nc{ltb} \nc{tb} \nc{tb} \nc{rtb}\sc{} \erow } \tfoot{\lastrule\strut} %R3B1 \brow \cell{C} \bb\cell{}\bb \nc{ltb} \nc{rtb}\sc{} \cell{} \cell{} \bb\cell{}\bb \nc{ltb} \nc{rtb}\sc{} \cell{} \cell{} \erow %R4B2 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R5B3 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R6B4 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R7B5 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R8B6 \brow \nc{lrt} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \ht\cals@current@row=2\normalbaselineskip \erow %R9B7 \brow \nc{lrb}\alignC\sc{C} \bb\cell{}\bb \cell{C} \cell{} \cell{} \cell{} \bb\cell{}\bb \cell{} \cell{} \cell{} \cell{} \erow %R10B9 % This last row is just to ‘fake’ double horizontal lines \brow \rb\bp\cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{} \cell{}\rb \cell{}\bp \ht\cals@current@row=2pt \erow \makeatletter \end{calstable}\par \vspace{1cm} \begin{calstable}[l] % Defining 5 columns, 1 are for double vertical rules (col2) \colwidths{{\dimexpr(\columnwidth/15*3)} {2pt} {\dimexpr(\columnwidth/15*2)} {\dimexpr(\columnwidth/15*1)} {\dimexpr(\columnwidth/15*3)} } \makeatletter % R1H1 % This first row is just to ‘fake’ double horizontal lines \thead{% \brow \rb\tp\cell{} \bb\cell{}\bb \cell{} \cell{} \cell{}\rb\tp \ht\cals@current@row=2pt \erow % %R2H2 % Header \brow \alignC\cell{C} \bb\cell{}\bb \cell{} \cell{} \cell{} \erow } \tfoot{\lastrule\strut} %R4B2 \brow \bb\cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R5B3 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R6B4 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R7B5 \brow \cell{C} \cell{} \cell{} \cell{} \cell{} \erow %R8B6 \brow \bb\cell{C}\bb \cell{} \bb\cell{} \cell{} \cell{}\bb \erow %R10B9 % This last row is just to ‘fake’ double horizontal lines \brow \bb\rb\bp\cell{} \cell{} \cell{} \cell{}\rb \cell{}\bb \ht\cals@current@row=2pt \erow \makeatletter \end{calstable}\par \end{document} 

tabularx and friends

Here is your first table typeset with tabularx and friends. As you will see, the setup and definition of columns and column width are pretty complicated. To have correct connecting rules I used the hhline package.

enter image description here

\documentclass{article} \usepackage{array, tabularx, multirow, hhline} % Two shorthands to secured equal rowhigh \newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}} \newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}} % Define four new X column types based on width. tabularx takes care of the math involved \newcolumntype{A}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize}X} \newcolumntype{B}{>{\centering\arraybackslash\hsize=0.17\hsize\linewidth=\hsize}X} \newcolumntype{C}{>{\centering\arraybackslash\hsize=0.11\hsize\linewidth=\hsize}X} \newcolumntype{D}{>{\centering\arraybackslash\hsize=0.05\hsize\linewidth=\hsize}X} % Uncomment to see margins etc. %\usepackage{showframe} %\renewcommand*\ShowFrameColor{\color{red}} %\renewcommand*\ShowFrameLinethickness{.15pt} \setlength{\tabcolsep}{0.5em} \setlength{\extrarowheight}{4pt} % Push first line of text away from rules above. \begin{document} \centering \begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|} \hhline{|*{9}{=}|} \hz B & \multicolumn{4}{c||}{} & \multicolumn{4}{c|}{}\\ \hhline{|-||----||----|} \hz B & \multicolumn{2}{c|}{} & & & \multicolumn{2}{c|}{} & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{\centering B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|-||--|-|-||--|-|-|} \vz \hz\multirow[c]{3}{=}{B} & & & & & & & & \\ \hhline{|~||--|-|-||--|-|-|} \hz & C & & & & & & & \\ \hhline{|*{9}{=}|} \end{tabularx} \end{document} 
Improved code and more explanations. Added code for second table. Changed picture.
Source Link
Sveinung
  • 20.8k
  • 2
  • 54
  • 76
Loading
Removed unnecessary code
Source Link
Sveinung
  • 20.8k
  • 2
  • 54
  • 76
Loading
Some more explanation.
Source Link
Sveinung
  • 20.8k
  • 2
  • 54
  • 76
Loading
Corrected code for spanning wrong cells
Source Link
Sveinung
  • 20.8k
  • 2
  • 54
  • 76
Loading
Source Link
Sveinung
  • 20.8k
  • 2
  • 54
  • 76
Loading