我认为多列函数正在覆盖我的表格宽度。第 4 列(1.4 厘米)和第 6 列(1.8 厘米)的宽度未按配置,应为 2.3 厘米,然后表格将与页面边框连接。
我试图删除第 4 列和第 6 列的多列,然后表格宽度为 2.3 厘米,但没有垂直线 :(
\begin{tabular}{@{}p{3cm}@{}@{}p{2.95cm}@{}|@{}p{2.3cm}@{}|@{}p{2.3cm}@{}@{}p{2.3cm}@{}|@{}p{2.3cm}@{}@{}p{1.5cm}@{}@{}p{0.8cm}@{}}
我的代码:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{array}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{makecell}
\usepackage[export]{adjustbox}
\usepackage{graphbox}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{paper=a4paper}
\geometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm},
includehead=false,
includefoot=true,footskip=10cm}
\pagestyle{fancy}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyfoot[CE,CO,LE,LO,RE,RO]{} %% clear out all footers
\fancyhf{} %% clear default for head and foot
\fancyfoot[C]{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,inner sep=0pt] at ($(current page.south west)+(2.5cm,1cm)$) {
\begin{tabular}{@{}p{3cm}@{}@{}p{2.95cm}@{}|@{}p{2.3cm}@{}|@{}p{2.3cm}@{}@{}p{2.3cm}@{}|@{}p{2.3cm}@{}@{}p{1.5cm}@{}@{}p{0.8cm}@{}}
\cline{3-8}
&
&
& \multicolumn{1}{c|}{}
&
& \multicolumn{1}{c|}{}
& \multicolumn{2}{c }{}
\bigstrut\\ \cline{3-8}
&
&
& \multicolumn{1}{c|}{}
&
& \multicolumn{1}{c|}{}
& \multicolumn{2}{c }{}
\bigstrut\\ \cline{3-8}
&
&
& \multicolumn{1}{c|}{}
&
& \multicolumn{1}{c|}{}
& \multicolumn{2}{c }{}
\bigstrut\\ \cline{3-8}
&
& \centering\textbf{\scriptsize A}
& \multicolumn{1}{c|}{\textbf{\scriptsize 1}}
& \centering\textbf{\scriptsize 1}
& \multicolumn{1}{c|}{\textbf{\scriptsize 1}}
& \multicolumn{2}{c }{\textbf{\scriptsize 1}}
\bigstrut\\ \cline{3-8}
&
& \multicolumn{1}{c|}{\scriptsize Rev.:}
& \multicolumn{1}{c|}{\scriptsize Datum:}
& \multicolumn{1}{c|}{\scriptsize Gezeichnet:}
& \multicolumn{1}{c|}{\scriptsize Überprüft:}
& \multicolumn{2}{c }{\scriptsize Genehmigt:}
\bigstrut\\ \hline
\scriptsize Klient:
& \multicolumn{3}{c}{\includegraphics[valign=c,scale=0.2]{example-image-a}}
& \multicolumn{3}{l}{\footnotesize Dummy text}
\bigstrut\\ \hline
\scriptsize Auftragnehmer:
& \multicolumn{3}{c}{\includegraphics[valign=c,scale=0.2]{example-image-a}}
& \multicolumn{3}{l}{\footnotesize Dummy text}
\bigstrut\\ \hline
\multicolumn{2}{@{}l|}{\scriptsize Projekt:}
& \scriptsize Vertrag Nr.:
& \multicolumn{3}{@{}l|}{\scriptsize Dokument Nr.:}
& \scriptsize Seite:
& \textbf{\footnotesize \thepage}
\bigstrut\\ \cline{7-8}
\multicolumn{2}{c|}{\textbf{\makecell{\footnotesize 1}}}
&
& \multicolumn{3}{c|}{\textbf{\footnotesize 1}}
& \makecell[l]{\scriptsize Gesamte\\\scriptsize Seite:}
& \textbf{\footnotesize \pageref*{LastPage}}
\bigstrut\\ \hline
\multicolumn{2}{@{}l|}{\scriptsize Titel:}
& \scriptsize Rahmen:
& \multicolumn{3}{@{}l|}{\scriptsize Rev.:}
& \scriptsize Format:
& \textbf{\footnotesize A4}
\bigstrut\\ \cline{7-8}
\multicolumn{2}{c|}{\textbf{\footnotesize 1}}
& \centering\textbf{\footnotesize 1:1}
& \multicolumn{3}{c|}{\textbf{\footnotesize A}}
& \scriptsize Sprache:
& \textbf{\footnotesize DE}
\bigstrut\\ \hline
\end{tabular}%
};
\end{tikzpicture}
}
\begin{document}
Dummy text
\end{document}
答案1
您应该从表中删除几乎所有内容\multicolumn{1}
,因为它们没有任何用处:如果您\multicolumn
在列中的每个单元格中使用,那么根本不会使用默认列规范。
在这里,您p
在表格前言中指定了一列,但随后您c
在每个条目中将其替换为,因此该列被设置为其内容的自然宽度。
您希望该列居中,scriptsize parbox 具有垂直规则,因此将其指定为
>{\centering \scriptsize}p{2.3cm}@{}|@{}
那么单元格数据就不需要额外的标记,可以简单地
& Datum:
我刚刚在这里处理了一个案例:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{array}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{makecell}
\usepackage[export]{adjustbox}
\usepackage{graphbox}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{paper=a4paper}
\geometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm},
includehead=false,
includefoot=true,footskip=10cm}
\pagestyle{fancy}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyfoot[CE,CO,LE,LO,RE,RO]{} %% clear out all footers
\fancyhf{} %% clear default for head and foot
\fancyfoot[C]{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,inner sep=0pt] at ($(current page.south west)+(2.5cm,1cm)$) {
\begin{tabular}{
@{}p{3cm}@{}@{}
p{2.95cm}@{}|@{}
p{2.3cm}@{}|@{}
>{\centering \scriptsize}p{2.3cm}@{}|@{}
p{2.3cm}@{}|@{}
p{2.3cm}@{}@{}
p{1.5cm}@{}@{}
p{0.8cm}@{}
}
\cline{3-8}
&
&
& \multicolumn{1}{c|}{}
&
& \multicolumn{1}{c|}{}
& \multicolumn{2}{c }{}
\bigstrut\\ \cline{3-8}
&
&
& \multicolumn{1}{c|}{}
&
& \multicolumn{1}{c|}{}
& \multicolumn{2}{c }{}
\bigstrut\\ \cline{3-8}
&
&
& \multicolumn{1}{c|}{}
&
& \multicolumn{1}{c|}{}
& \multicolumn{2}{c }{}
\bigstrut\\ \cline{3-8}
&
& \centering\textbf{\scriptsize A}
& \multicolumn{1}{c|}{\textbf{\scriptsize 1}}
& \centering\textbf{\scriptsize 1}
& \multicolumn{1}{c|}{\textbf{\scriptsize 1}}
& \multicolumn{2}{c }{\textbf{\scriptsize 1}}
\bigstrut\\ \cline{3-8}
&
& \multicolumn{1}{c|}{\scriptsize Rev.:}
& Datum:
& \multicolumn{1}{c|}{\scriptsize Gezeichnet:}
& \multicolumn{1}{c|}{\scriptsize Überprüft:}
& \multicolumn{2}{c }{\scriptsize Genehmigt:}
\bigstrut\\ \hline
\scriptsize Klient:
& \multicolumn{3}{c}{\includegraphics[valign=c,scale=0.2]{example-image-a}}
& \multicolumn{3}{l}{\footnotesize Dummy text}
\bigstrut\\ \hline
\scriptsize Auftragnehmer:
& \multicolumn{3}{c}{\includegraphics[valign=c,scale=0.2]{example-image-a}}
& \multicolumn{3}{l}{\footnotesize Dummy text}
\bigstrut\\ \hline
\multicolumn{2}{@{}l|}{\scriptsize Projekt:}
& \scriptsize Vertrag Nr.:
& \multicolumn{3}{@{}l|}{\scriptsize Dokument Nr.:}
& \scriptsize Seite:
& \textbf{\footnotesize \thepage}
\bigstrut\\ \cline{7-8}
\multicolumn{2}{c|}{\textbf{\makecell{\footnotesize 1}}}
&
& \multicolumn{3}{c|}{\textbf{\footnotesize 1}}
& \makecell[l]{\scriptsize Gesamte\\\scriptsize Seite:}
& \textbf{\footnotesize \pageref*{LastPage}}
\bigstrut\\ \hline
\multicolumn{2}{@{}l|}{\scriptsize Titel:}
& \scriptsize Rahmen:
& \multicolumn{3}{@{}l|}{\scriptsize Rev.:}
& \scriptsize Format:
& \textbf{\footnotesize A4}
\bigstrut\\ \cline{7-8}
\multicolumn{2}{c|}{\textbf{\footnotesize 1}}
& \centering\textbf{\footnotesize 1:1}
& \multicolumn{3}{c|}{\textbf{\footnotesize A}}
& \scriptsize Sprache:
& \textbf{\footnotesize DE}
\bigstrut\\ \hline
\end{tabular}%
};
\end{tikzpicture}
}
\begin{document}
Dummy text
\end{document}