我无法将 calstable 置于页面中央。我看到了此帖子这里并尝试了解决方案,但我的表格格式不正确。
还有其他方法可以解决这个问题吗?这是我的表格:
\documentclass[a4paper,12pt]{scrreprt}
\usepackage[margin=0.7in]{geometry}
\usepackage[parfill]{parskip}
\usepackage[utf8]{inputenc}
\usepackage{cals}
% Related to math
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage[table,xcdraw]{xcolor}
\let\nc=\nullcell % Shortcuts
\let\sc=\spancontent
\definecolor{darkGreen}{HTML}{C0E5C6}
\definecolor{lightGreen}{HTML}{E2EFD9}
\begin{document}
\begin{center}
\begin{calstable}
\centering
% Defining 3 column relativ to each other and relativ to the margins
\colwidths{{\dimexpr(\columnwidth/16*4)\relax}
{\dimexpr(\columnwidth/16*3)\relax}
{\dimexpr(\columnwidth/16*3)\relax}
}
% The tabular fills 5/8 of the text area
% Set up the tabular
\makeatletter
\def\cals@framers@width{0.4pt} % Outside frame horizontal rules
\def\cals@framecs@width{0.4pt} % Outside frame horizontal rules, reduce
% thickness if you find them too heavy
\cals@setpadding{Ag}
\cals@setcellprevdepth{Al}
\def\cals@cs@width{0.4pt} % Inside rules, reduce if the rule is too heavy
\def\cals@rs@width{0.4pt}
\def\cals@bgcolor{} % Define cals@bgcolor to empty
\def\green{\ifx\cals@bgcolor\empty % Colour switch (on-off)
\def\cals@bgcolor{darkGreen}
\else \def\cals@bgcolor{} \fi}
\def\lgreen{\ifx\cals@bgcolor\empty % Colour switch (on-off)
\def\cals@bgcolor{lightGreen}
\else \def\cals@bgcolor{} \fi}
\def\tb{\ifx\cals@borderT\relax % Top border switch (off-on)
\def\cals@borderT{0pt}
\else \let\cals@borderT\relax\fi}
\def\bb{\ifx\cals@borderB\relax % Botton border switch (off-on)
\def\cals@borderB{0pt}
\else \let\cals@borderB\relax\fi}
\def\rb{\ifx\cals@borderR\relax % Right border switch (off-on)
\def\cals@borderR{0pt}
\else \let\cals@borderR\relax\fi}
% R1 Body
\brow
\green\alignC\cell{Modell-Überkategorien}\green
\tb\rb\nc{lt}
\nc{rt}\tb\rb
\erow
% R2 Body
\brow
\cell{statisch}
\rb\nc{l}
\nc{r}\rb
\erow
% R3 Body
\brow
\cell{zufällig (Monte-Carlo)}
\rb\nc{lb}
\nc{rb}\sc{}\rb
\erow
% R4 Body
\brow
\lgreen\nc{lrt}
\cell{Kontinuirlich}
\nc{lrt}
\erow
% R5 Body
\brow
\nc{lr}
\cell{Hybrid}
\nc{lr}
\erow
% R6 Body
\brow
\nc{lrb}\sc{\vfil dynamisch}
\cell{Diskret}
\nc{lrb}\sc{\vfil Raum/Zeit}
\erow
% R7 Body
\brow
\cell{(Multi)-Agenten basiert}\lgreen
\rb\bb\nc{ltb}
\nc{rtb}\sc{}\bb\rb
\erow
\makeatletter
\end{calstable}\par % \par needed to align the tabular
\end{center}
\end{document}
答案1
我似乎有点盲目。在第一页找到了答案可转换描述。像这样添加属性 c 可以解决问题。
\begin{calstable}[c]