![表格/tikzpicture 内的多行/列和图形](https://linux22.com/image/302514/%E8%A1%A8%E6%A0%BC%2Ftikzpicture%20%E5%86%85%E7%9A%84%E5%A4%9A%E8%A1%8C%2F%E5%88%97%E5%92%8C%E5%9B%BE%E5%BD%A2.png)
我当前尝试编写我想要的代码时遇到了一些问题:
我绝对不是一个经验丰富的 LaTeX 作家,所以我很乐意对代码的每个部分进行输入,即使它与主要问题没有真正的联系!
我的代码目前看起来像:(徽标图片只是一个例子,我使用了http://media02.hongkiat.com/psd-text-svg/logo-example.jpg)
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{fit}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{tabularx}
\usepackage{tabu}
\usepackage{booktabs}
\usepackage{multirow,bigstrut}
\usepackage[utf8]{inputenc}
\usepackage[margin=0.2in]{geometry}
\definecolor{Gray}{gray}{0.9}
\begin{document}
\begin{tikzpicture}
\node[inner sep=0pt] (tab){%
\centering
\renewcommand{\arraystretch}{2}
\begin{tabular}{l|l|ll} \cline{2-4}
\multirow{2}[2]{*}[-1mm]{\includegraphics[scale=0.2]{Logo}} &{\Large Header} &\multicolumn{1}{l}{{\large author:}} & \multicolumn{1}{l|}{{name}}\\
\cline{2-4} & {\Large Receptor} & Page 1/n & \multicolumn{1}{c|}{{date}} \\
\rowcolor{Gray}\textbf{} &\textbf{} & \multicolumn{2}{l}{\textbf{}}\\ \hline
\multicolumn{4}{|l|}{\multirow{5}{*}{iggujhjhhhjhvjhvjhvvvhjvhbkjbk}} \\
\multicolumn{4}{|l|}{} \\
\multicolumn{4}{|l|}{} \\
\multicolumn{4}{|l|}{} \\
\multicolumn{4}{|l|}{} \\ \hline
\end{tabular}
};
\node[draw=black,inner sep=20pt, rounded corners=10pt, line width=1pt,
fit=(tab.north west) (tab.north east) (tab.south east) (tab.south west)] {};
\end{tikzpicture}
\end{document}
只是几个附带问题:
有没有办法获取瑞典语中的当前日期?我目前正在手动进行。
有没有办法自动设置当前页数/总页数?例如,第 1/5 页,即总共 5 页中的第 1 页。
有没有办法可以预先指定表格的总宽度和高度?
答案1
tcolorbox
这是使用 和的起点tabularray
:
\documentclass[12pt]{article}
\usepackage[swedish]{babel}
\usepackage[margin=0.2in]{geometry}
\usepackage{tcolorbox}
\definecolor{Gray}{gray}{0.9}
\tcbset{%
mybox/.style={
colback=white,
% You may use the tcolorbox width to set the width of your table using X columns (but it's only one of the n possibilities
width=15cm,
},
}
\usepackage{tabularray}
\usepackage{lastpage}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{blindtext}% <--- for testing purpose only
\begin{document}
\begin{tcolorbox}[mybox]
\begin{tblr}{colspec={lXlX},
hlines,
vline{1-X,Z}={solid},
vspan=even,
hspan=minimal,
row{Z}={m},
cell{1}{1}={r=2}{m},
cell{Z}{1}={c=4}{m}
}
\includegraphics[scale=0.2]{example-image} & Header & Author: & Name\\
& Receptor & Page \thepage/\pageref{LastPage} & \today\\
\includegraphics[scale=0.2]{example-image-a} Some text
\blindtext &&&\\
\end{tblr}
\end{tcolorbox}
\end{document}