当我使用这个作品时,
\documentclass[a4paper,12pt]{report}
\usepackage[inner=0.75in,outer=0.65in,top=0.75in,bottom=0.65in]{geometry}
\usepackage{multirow}
\usepackage{spreadtab}
\usepackage{url}
\usepackage[sc]{mathpazo}{setspace}
\begin{document}
\begin{table}[!htb]
\centering
\caption{Sample} \vspace{3pt}
\begin{spreadtab}{{tabular}{|l|c|c|c|}}
\hline
@ b1 & 1 & 2 & 3 \\ \hline
@ b2 & 1 & 2 & 3 \\ \hline
@ \textbf{Sub Total} & \textbf{:={b1+b2}}
&\textbf{:={c1+c2}}&\textbf{:={d1+d2}}\\ \hline
@ b5 & 1 & 2 & 3 \\ \hline
@ b6 & 1 & 2 & 3 \\ \hline
@ Sub Total & \STcopy{>}{b5+b4} & & \\ \hline
@ b9 & 1 & 2 & 3 \\ \hline
@ b10 & 1 & 2 & 3 \\ \hline
@ Sub Total & \STcopy{>}{b7+b8} & & \\ \hline \hline
@ Total & \STcopy{>}{b3+b6+b9} & & \\ \hline
\end{spreadtab}
\label{tab:key}
\end{table}
Used in Table:~\ref{tab:key}
\end{document}
我得到了部分我想要的,当我添加其余的东西时,
\documentclass[a4paper,12pt]{article}
\usepackage[inner=0.75in,outer=0.65in,top=0.75in,bottom=0.65in]{geometry}
\usepackage{multirow}
\usepackage{spreadtab}
\usepackage[sc]{mathpazo}
\usepackage[onehalfspacing]{setspace}
\begin{document}
\begin{table}[!htb]
\centering
\caption{Sample} \vspace{3pt}
\begin{spreadtab}{{tabular}{|c|l|c|c|c|}}
\hline
\multirow{2}{*}{Sl No.} & \multirow{2}{*}{\textbf{Something}} &
\multicolumn{3}{c|}{\textbf{something}}\\ \cline{3-5}
& & \textbf{X} & \textbf{Y} & \textbf{Z} \\ \hline
1 & @ b3 & 1 & 2 & 3 \\ \hline
2 & @ b4 & 1 & 2 & 3 \\ \hline
\multicolumn{1}{|c}{} & \multicolumn{1}{|l}{\textbf{Sub Total}} &
\textbf{:={c3+c4}} & \textbf{:={d3+d4}} & \textbf{:={e3+e4}} \\ \hline
3 & @ b6 & 1 & 2 & 3 \\ \hline
4 & @ b7 & 1 & 2 & 3 \\ \hline
\multicolumn{1}{|c}{} & \multicolumn{1}{|l}{\textbf{Sub Total}} &
\STcopy{>}{c6+c7}& & \\ \hline
5 & @ b9 & 1 & 2 & 3 \\ \hline
6 & @ b10 & 1 & 2 & 3 \\ \hline
\multicolumn{1}{|c}{} & \multicolumn{1}{|l}{\textbf{Sub Total}} &
\STcopy{>}{c9+c10} & & \\ \hline \hline
\multicolumn{1}{|c}{} & \multicolumn{1}{|l}{\textbf{Total}} &
\STcopy{>}{c5+c8+c11} & & \\ \hline
\end{spreadtab}
\label{tab:key}
\end{table}
Used in Table:~\ref{tab:key}
\end{document}
我遇到了错误。我可以用上面的代码来获取
还是所有内容都应手动输入?
答案1
这是我的代码:
\documentclass[a4paper,12pt]{article}
\usepackage[inner=0.75in,outer=0.65in,top=0.75in,bottom=0.65in]{geometry}
\usepackage{multirow}
\usepackage{spreadtab}
\usepackage[sc]{mathpazo}
\usepackage[onehalfspacing]{setspace}
\begin{document}
\begin{table}[!htb]
\centering
\caption{Sample} \vspace{3pt}
\begin{spreadtab}{{tabular}{|c|l|c|c|c|}}
\hline
@\multirow{2}{*}{Sl No.} & @\multirow{2}{*}{\textbf{Something}} &
@\multicolumn{3}{c|}{\textbf{something}}\\ \cline{3-5}
& & @\textbf{X} & @\textbf{Y} & @\textbf{Z} \\ \hline
1 & @ \STtextcell\ b3 & 1 & 2 & 3 \\ \hline
2 & @ \STtextcell\ b4 & 1 & 2 & 3 \\ \hline
@\multicolumn{1}{|c}{} & @\multicolumn{1}{l|}{\textbf{Sub Total}} &
\textbf{:={c3+c4}} & \textbf{:={d3+d4}} & \textbf{:={e3+e4}} \\ \hline
3 & @ \STtextcell\ b6 & 1 & 2 & 3 \\ \hline
4 & @ \STtextcell\ b7 & 1 & 2 & 3 \\ \hline
@\multicolumn{1}{|c}{} & @\multicolumn{1}{l|}{\textbf{Sub Total}} &
{\fontseries{b}\selectfont}\STcopy{>}{c6+c7} & \textbf{:={}} & \textbf{:={}}\\ \hline
5 & @ \STtextcell\ b9 & 1 & 2 & 3 \\ \hline
6 & @ \STtextcell\ b10 & 1 & 2 & 3 \\ \hline
@\multicolumn{1}{|c}{} & @\multicolumn{1}{l|}{\textbf{Sub Total}} &
{\fontseries{b}\selectfont}\STcopy{>}{c9+c10} & \textbf{:={}} & \textbf{:={}} \\ \hline \hline
@\multicolumn{1}{|c}{} & @\multicolumn{1}{l|}{\textbf{Total}} &
{\fontseries{b}\selectfont}\STcopy{>}{c5+c8+c11} & \textbf{:={}} & \textbf{:={}} \\ \hline
\end{spreadtab}
\label{tab:key}
\end{table}
Used in Table:~\ref{tab:key}
\end{document}
结果如下:
一些评论
@
要在环境内打印,spreadtab
您必须使用命令\STtextcell
。- 每个不包含计算(或仅包含数字)的单元格都必须包含字符
@
。 - 如果在使用时想要使用粗体单元格,
\STcopy
则必须添加带有空计算的单元格,例如\textbf{:={}}