我是 LaTeX 初学者,所以如果这个问题有明显的解决方案或已经得到解答,我提前道歉。我必须为大学写一份关于实验室实验的简短技术报告,老师给了我们一个 .doc 格式的模板,说我们可以使用任何我们想要的排版程序,只要最终产品与模板有相似之处即可。现在,我想使用 LaTeX 来轻松绘制图形和表格等,但我不知道如何排版这样的内容。
[编辑]这就是我想出的;我不知道如何进一步细分右下角的列,而且我的代码的几个部分很笨拙(也就是说,我希望表格总是适合整个可用内容,无论它里面是什么文本)
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{center}
\begin{tabular}{| l | l |}
\hline
& \\
\multirow{2}{*}{Report Tecnico} & Data: XX/YY/ZZ \\
& Nome File : xxxx.yyy\\
& \\ \hline
\multicolumn{2}{|l|}{ }\\
\multicolumn{2}{|l|}{Titolo: }\\
\multicolumn{2}{|l|}{ }\\
\multicolumn{2}{|l|}{".................."}\\
\hline
\multicolumn{2}{|l|}{Progetto o ordine di riferimento:}\\
\multicolumn{2}{|l|}{ }\\
\multicolumn{2}{|l|}{"......................"}\\
\multicolumn{2}{|l|}{REF. {\#}data}\\
\hline
Autore: AAA BBBB & \\
& \multirow{2}{*}{Descrizione Revisioni}\\
& \\
Approvato da: CCC DDDD & \\
\hline
& \\
Destinatari: & 0\qquad Primo rilascio Rev 0 \qquad data\\
& \\
\end{tabular}
\end{center}
\end{document}
有谁可以来救我吗?
答案1
我使用了tabularx
一些p
列来确保内容不会超出边距。此外,由于宽度以\textwidth
分数表示,因此如果您更改边距,应该很容易调整表格(我假设您不想要article
这种表格的标准边距,但这只是猜测)
\documentclass{article}
\usepackage{multirow}
\usepackage{array}
\usepackage{tabularx}
% \usepackage{showframe}
\newcolumntype{L}{p{.5\textwidth}}
\newcolumntype{S}{>{\centering\arraybackslash}p{.1667\textwidth}}
\newcolumntype{R}{p{.1667\textwidth}}
\renewcommand{\arraystretch}{1.8}
\begin{document}
\begin{tabularx}{\textwidth}{|X|R|R|R|}\hline
Report Tecnico & \multicolumn{3}{X|}{Data: XX/YY/ZZ} \\
& \multicolumn{3}{X|}{Nome File : xxxx.yyy} \\\hline
\multicolumn{4}{|X|}{Titolo: } \\
\multicolumn{4}{|X|}{".................."} \\\hline
\multicolumn{4}{|l|}{Progetto o ordine di riferimento:} \\
\multicolumn{4}{|X|}{ } \\
\multicolumn{4}{|X|}{"......................"} \\
\multicolumn{4}{|X|}{REF. {\#}data} \\\hline
Autore: AAA BBBB & \multicolumn{3}{X|}{} \\[-7pt]
& \multicolumn{3}{X|}{Descrizione Revisioni} \\[-7pt]
Approvato da: CCC DDDD & \multicolumn{3}{X|}{} \\\hline
\multirow{2}{.35\textwidth}{Destinatari:} & \multicolumn{3}{p{.57\textwidth}|}{0\qquad Primo rilascio Rev 0 \qquad data} \\
& \multicolumn{3}{X|}{} \\
& \multicolumn{3}{p{.57\textwidth}|}{Pagine revisionate} \\\cline{2-4}
& \multicolumn{1}{S|}{Paragrafo} & \multicolumn{1}{S|}{Revisione} & \multicolumn{1}{S|}{Data} \\[-10pt]
& \multicolumn{1}{S|}{} & \multicolumn{1}{S|}{} & \multicolumn{1}{S|}{} \\\cline{2-4}
& content will go here content will go here content will go here & content will go here & content will go here \\\hline
\end{tabularx}
\end{document}
表格中最脆弱的部分是multirow
单元格。一般来说,您需要将\newline
代码中用到的每个单元格的第一个参数增加 1。稍微测试一下,您就会明白我的意思。
我试图以可读的方式格式化代码,但这并非易事:)showframe
如果您想测试边距,可以使用该包。
答案2
作为一种不基于标准表格包的替代方法,我尝试使用tcolorbox
es 和xcoffin
s 的组合。在这种情况下,众所周知的表格方法可能更简单,这只是为了好玩。
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
% \usepackage{showframe}
\usepackage{xcoffins}
\NewCoffin{\cL}
\NewCoffin{\cRT}
\NewCoffin{\cRM}
\NewCoffin{\cRB}
\setlength{\parindent}{0pt}
\newtcolorbox{structure}[1][]{
enhanced,
boxrule=0.4pt,
colback=white,
colbacktitle=white,
coltitle=black,
center title,
left=.025\textwidth,
right=.025\textwidth,
lefttitle=2pt,
righttitle=2pt,
arc=0pt,
outer arc=0pt,
nobeforeafter,
before=,
after=\vspace*{-1pt},
#1
}
\newcommand{\topbox}[2]{
\begin{structure}[valign=center,center upper,height=.075\textheight,width=.45\textwidth]
\textbf{Report tecnico}
\end{structure}%
\begin{structure}[valign=center,center upper,height=.075\textheight,width=.55\textwidth]
\textbf{Data:} #1
\medskip
\textbf{Nome file:} #2
\end{structure}%
}
\newcommand{\mytitle}[1]{
\begin{structure}[height=.1\textheight]
\textbf{Titolo:} #1
\end{structure}
}
\newcommand{\project}[2]{
\begin{structure}[height=.15\textheight]
\textbf{Progetto o ordine di riferimento:}
\medskip
#1
\vskip3em
\textbf{REF.} #2
\end{structure}
}
\newcommand{\middlebox}[3]{
\begin{structure}[valign=center,width=.45\textwidth,height=.1\textheight]
\textbf{Autore:} #1
\bigskip
\textbf{Approvato da:} #2
\end{structure}%
\begin{structure}[valign=center,width=.55\textwidth,height=.1\textheight]
#3
\end{structure}%
}
\newcommand{\recipients}[1]{%
\SetHorizontalCoffin{\cL}{%
\begin{structure}[width=.45\textwidth,height=.575\textheight]
\textbf{Destinatari:}
#1
\end{structure}%
}%
}
\newcommand{\release}[1]{
\SetHorizontalCoffin{\cRT}{%
\begin{structure}[width=.55\textwidth,height=.15\textheight]
#1
\end{structure}%
}%
}
\newcommand{\revisions}[1]{
\SetHorizontalCoffin{\cRM}{%
\begin{structure}[width=.55\textwidth,height=.05\textheight]
\textbf{Pagine revisionate:} #1
\end{structure}%
}%
}
\newcommand{\lowerleftbox}[3]{
\SetHorizontalCoffin{\cRB}{%
\begin{structure}[width=.2\textwidth,height=.375\textheight,adjusted title={Paragrafo}]
#1
\end{structure}%
\begin{structure}[width=.2\textwidth,height=.375\textheight,adjusted title={Revisione}]
#2
\end{structure}%
\begin{structure}[width=.15\textwidth,height=.375\textheight,adjusted title={Data}]
#3
\end{structure}%
}%
}
\begin{document}
\topbox %
{10/10/10}
{filename}
\mytitle
{Title}
\project
{.......}
{\# data}
\middlebox
{Author}
{Reviewer}
{Descrizione revisioni}
\recipients
{
Recipent 1
Recipient 2
}
\release
{0\qquad Primo rilascio Rev 0 \qquad data}
\revisions
{100}
\lowerleftbox
{A}
{B}
{C}
\JoinCoffins{\cL}[t,r]{\cRT}[t,l](-.1pt, 0cm)%
\JoinCoffins{\cL}[\cRT-b,r]{\cRM}[t,r](-.1pt, 0cm)%
\JoinCoffins{\cL}[\cRM-b,r]{\cRB}[t,r](-.1pt, 0cm)%
\TypesetCoffin{\cL}
\end{document}
Okular 用户:Okular 存在规则问题,并且在某些缩放级别隐藏了其中一些规则。
答案3
你的代码可能是这样的
\documentclass{book}
\usepackage{booktabs}
\usepackage{multicol}
\usepackage{multirow}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|l|llc|}
\toprule
\multirow{2}{*}{Report Tecnico} & \multicolumn{3}{l|}{Data: XX/YY/ZZ} \\
&\multicolumn{3}{l|} {Nome File : xxxx.yyy} \\
\midrule
\multicolumn{4}{|l|}{ }\\
\multicolumn{4}{|l|}{Titolo: }\\
\multicolumn{4}{|l|}{ }\\
\multicolumn{4}{|l|}{".................."}\\
\midrule
\multicolumn{4}{|l|}{Progetto o ordine di riferimento:}\\
\multicolumn{4}{|l|}{ }\\
\multicolumn{4}{|l|}{"......................"}\\
\multicolumn{4}{|l|}{REF. {\#}data}\\
\midrule
Autore: AAA BBBB & \multicolumn{3}{l|}{}\\
& \multicolumn{3}{l|}{Descrizione Revisioni}\\
Approvato da: CCC DDDD & \multicolumn{3}{l|}{}\\
\midrule
\multirow{2}{*}{Destinatari:} &\multicolumn{3}{l|}{0 Primo rilascio Rev 0 data}\\
& \multicolumn{3}{l|}{}\\ \cline{2-4}
Istituzione & \multicolumn{3}{l|}{}\\
{Nome} & \multicolumn{3}{l|}{}\\
& \multicolumn{3}{l|}{Pagine revisonate}\\
& \multicolumn{1}{l}{} &\multicolumn{1}{l}{} &\\\cline{2-4}
&\multicolumn{1}{l|}{Paragrapo}&\multicolumn{1}{l|}{Revisions} &Date\\
& \multicolumn{1}{l|}{} &\multicolumn{1}{l|}{} &\\\cline{2-4}
&\multicolumn{1}{l|}{}&\multicolumn{1}{l|}{}&\\
&\multicolumn{1}{l|}{}&\multicolumn{1}{l|}{}&\\
&\multicolumn{1}{l|}{}&\multicolumn{1}{l|}{}&\\
&\multicolumn{1}{l|}{}&\multicolumn{1}{l|}{}&\\
&\multicolumn{1}{l|}{}&\multicolumn{1}{l|}{}&\\
&\multicolumn{1}{l|}{}&\multicolumn{1}{l|}{}&\\
\midrule
\bottomrule
\end{tabular}
\end{table}
\end{document}