答案1
有一些微妙的点:
- 页眉中的垂直间距
- 引导点之间的对齐
- 最后两列的水平对齐
这是解决这些问题的一种方法。该\?
命令产生一个与数字一样宽的水平空间。
\documentclass{article}
\usepackage{textcomp}
\usepackage{tgschola}
\usepackage{tabularx}
\newcolumntype{I}{@{}X<{\xdotfill}}
\newcolumntype{R}{>{\qq}r<{\qq}}
\makeatletter
% http://tex.stackexchange.com/questions/41758/how-can-i-reproduce-this-table-with-thick-lines
\newcommand{\thickhline}{%
\noalign {\ifnum 0=`}\fi \hrule height 1pt
\futurelet \reserved@a \@xhline
}
% dot filler
\newcommand{\xdotfill}{\leavevmode\leaders\hb@[email protected]{\hss.\hss}\hfill\hskip-\tabcolsep\kern\z@}
\makeatother
\newcommand\qq{\quad}
\newcommand\tablesec[1]{\multicolumn{1}{@{}l|}{#1}&&\\}
\newcommand\tabletitle[1]{\multicolumn{1}{@{}c|}{\SEPx{2}#1}}
\newcommand\SEPx[1]{\vrule width 0pt height \dimexpr\fontcharht\font`A+2ex depth #1ex\relax}
\newcommand\SEP{\SEPx{0}}
\newcommand\?{\hphantom{0}}
\begin{document}
\renewcommand{\arraystretch}{1.2}
\noindent
\begin{tabularx}{\linewidth}{I|R|R}
\thickhline
\tabletitle{Item} & \multicolumn{1}{c|}{1939} & \multicolumn{1}{c}{1940}\\
\hline\SEP
Sales & \$187,400 & \$468,300 \\
Net income & 18,284 & 27,684 \\
\tablesec{Dec. 31 figures:}
\qq Inventory & 44,163 & 74,452 \\
\qq Total current assets & 76,995 & 109,481\\
\qq Current ratio & 3.7:1\? & 2.0:1\? \\
\qq Working capital per dollar of sales & 41\textcent\? & 23\textcent\? \\
\tablesec{Per share of common:}
\qq Earned in year & \$4.22\?\? & \$10.02\?\? \\
\qq Dividend & 4.00\?\? & 4.00\?\? \\
\qq Net-asset value & 45\? & 76\? \\[2ex]
\thickhline
\end{tabularx}
\end{document}
答案2
这并不难做到。在下面的代码中,我用来\dotfill
填充单元格,并为无点小节和缩进创建了一些命令。
字体完全由您决定。对于可免费获得的类似字体,我使用了 TeX Gyre Schola,它是 Century Schoolbook 的克隆版。但如果您使用 XeLaTeX 或 LuaLaTeX,您可以购买所需的实际字体并使用它。
\documentclass[12pt]{article}
\usepackage{tgschola}
\usepackage{tabularx}
\newcolumntype{D}{X<{\dotfill}@{}}
\newcommand\ind{\hspace{2em}}
\newcommand\subtitle[1]{\multicolumn{1}{X@{}|}{#1}}
\begin{document}
\setlength{\extrarowheight}{.5ex}
\begin{tabularx}{\linewidth}{D|r|r}
\hline
\multicolumn{1}{c|@{}}{Item} & \multicolumn{1}{c|}{1939} & \multicolumn{1}{c}{1940}\\
\hline
Sales & \$187,400 & \$468,300 \\
Net income & 18,284 & 27,684 \\
\subtitle{Dec. 31 figures:} & & \\
\ind Inventory & 44,163 & 74,452 \\
\ind Total current assets & 76,995 & 109,481\\
\hline
\end{tabularx}
\end{document}
如果缩进行数远多于非缩进行数,则可以使用其他格式来简化输入。在此代码中,我已将默认行设为缩进和带点,并为无点字幕和带点标题定义了命令。这样就无需\ind
对每个缩进行使用命令。
\documentclass[12pt]{article}
\usepackage{tgschola}
\usepackage{tabularx}
\newcolumntype{D}{X<{\dotfill}@{}}
\newcommand\ind{\hspace{2em}}
\newcommand\dottitle[1]{\multicolumn{1}{D|}{#1}}
\newcommand\subtitle[1]{\multicolumn{1}{X@{}|}{#1}}
\begin{document}
\setlength{\extrarowheight}{.5ex}
\begin{tabularx}{\linewidth}{>{\ind}D|r|r}
\hline
\multicolumn{1}{c|@{}}{Item} & \multicolumn{1}{c|}{1939} & \multicolumn{1}{c}{1940}\\
\hline
\dottitle{Sales} & \$187,400 & \$468,300 \\
\dottitle{Net income} & 18,284 & 27,684 \\
\subtitle{Dec. 31 figures:} & & \\
Inventory & 44,163 & 74,452 \\
Total current assets & 76,995 & 109,481\\
\hline
\end{tabularx}
\end{document}