I am interested in using LaTeX to recreate some old financial reports. How would I make the following chart, including the proper (or similar) font? The font has been identified as Monotype's Century.
2 Answers
There are some subtle points:
- The vertical spacing in the header
- Alignment between the leader dots
- Horizontal alignment in the last two columns
Here's a way for solving these issues. The \?
command produces a horizontal space as wide as a digit.
\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@xt@.44em{\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}
-
You guys are stars (also @alan-munn)! I've been stepping through this code, and wondering if there is a way to get the "big"
X
as in OP's pic. Best I could come up with is, e.g.,4.2\MVMultiplication\?
using themarvosym
pakage (from Comprehensive Symbol list). | p.s. I'm also impressed that the commented link got picked up in the sidebar, although on reflection that should be expected. Still ... nice. :) | + the original 1940 "Current ratio" is misaligned?– DɑvïdMar 8, 2016 at 10:37 -
-
-
Thank you so much. How would you make the table's title since the font is now the all-capital version?– cpageMar 9, 2016 at 0:49
This isn't very hard to do. In the code below, I've used \dotfill
to fill the cells and made a couple of commands for the undotted subsections and the indent.
The font is really up to you. For a freely available similar font I've used TeX Gyre Schola which is a Century Schoolbook clone. But if you use XeLaTeX or LuaLaTeX you can buy the actual font you want and use that instead.
\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}
If the number of indented lines is much more than the number of non-indented lines, then an alternative format would make the input easier. In this code, I've made the default row be indented and dotted, and defined commands for the undotted subtitles and the dotted titles. This removes the need to use the \ind
command for each indented row.
\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}
\dotfill
command. Have you tried anything so far?