Robert Sedgewick - LaTeX 算法第四版样式

Robert Sedgewick - LaTeX 算法第四版样式

最近看了Robert Sedgewick的《算法》(Java版)第四版,除了内容实用有趣,书的风格也让我着迷,后来又看了这位教授写的几篇论文,很喜欢他的排版风格。

这是一个例子

我知道这种风格的设置应该很复杂...但是,有谁知道如何制作类似这种风格的论文吗?

答案1

这篇论文看起来确实不错,比用 *TeX (、InDesign 或任何应用程序) 制作的大多数其他科学论文要好得多。@David:我不认为 Sedgewick 选择 InDesign 是这篇特定文档整体外观的主要因素:他所做的几乎所有工作都可以用 TeX 完成(有些做得更好)。

然而,我发现他的一些选择相当糟糕,例如:

  • 由于宽度测量和 Adob​​e Minion 的点尺寸太小,导致行数非常长(有时超过 100 个字符!)。

  • 使用新人文主义字体,即15世纪晚期风格的字体大胆的变体。我知道,人们总是这么做,但一旦你意识到粗体直到 19 世纪中期才发明,它就会在暗示中世纪晚期排版的背景下看起来很奇怪。更合适的选择是使用正文字体的大写字母、小写字母或斜体——或者匹配无衬线字体的粗体:Minion Regular + Myriad Bold;Palatino Regular + Syntax Bold;Bembo Regular + Scala Sans Bold 等。

  • 整体外观的拥挤。如果论文中没有那么多“嘿,看我,我是一篇花哨的文本”的换行图(我想说:完全放弃换行),行距更宽(以弥补行长造成的可读性损失),并且各部分之间的分隔更清晰,那将大有裨益。我确实喜欢插入标题,但在这种情况下,我发现独立标题会是更好的选择。例如,请看第 3 页。在我看来,很难立即看出该页面的最后一段是“2-3 棵树”部分的一部分,还是在插入标题所表示的节之外。此外,他使用插入标题作为高达 2 级的节的标题(!),无法让眼睛有机会在节之间“休息”。对我来说,它只是一个节接一个节,中间只有微弱的额外垂直空白。我赞同保护树木这一宗旨,但如果电子文档由于设计选择提高可读性而多出两三页,树木也不会受到伤害。是的,有些人(比如我)更喜欢在阅读之前打印出来,但如果文档不那么拥挤,字体大小可能增加 1pt,那么每张纸就可以轻松打印在对树木友好的 2x2 页面上。

  • 缺少页码:我不知道如何处理无法正确引用的工作论文

  • \nonfrencspacing使用古老的“盎格鲁-撒克逊间距”,即在 LaTeX 中模拟在句号后按两次空格键,就像打字机时代一样

  • 混合不同的对齐方式:有居中元素、左对齐元素,甚至还有右对齐元素。你可以说我保守,但我甚至不会混合一本书内即可找到所有

现在我觉得我必须重复一遍,我仍然觉得这篇论文比大多数其他科学家的论文要好得多(我们不要谈论人文学科的论文……)。话虽如此,我并不头脑那些纸张看起来就是这样的;因为它们大多数只是用来工作的东西,并不声称自己是印刷杰作。

这篇论文没有什么太复杂的。在 InDesign 中可能比在 TeX 中更容易做的唯一一件事是包装图形,但即使如此,也有一个包可以实现这一点:——如果你真的想要它们。这里有一个粗略的框架可以帮助你入门。

\documentclass[12pt,DIV=9]{scrartcl}

\usepackage[english]{babel}
\usepackage{csquotes}              % smarter quotes
\usepackage{blindtext}             % dummy text
\usepackage{xcolor}                % color support
\usepackage{microtype}             % microtypographic tuning
\usepackage{scrpage2}              % smarter headers and footers
\usepackage[para,norule]{footmisc} % smarter footnotes
\usepackage[framemethod=tikz]{mdframed} % background color for paragraphs
\usepackage{leading}               % leading
\leading{16pt}

% % pdfTeX only:
% \usepackage[utf8]{inputenc}
% \usepackage[T1]{fontenc}
% \usepackage{sourcecodepro} % Source Code Pro from Adobe, should come with your TeX distribution
% \usepackage{sourcesanspro} % Source Sans Pro from Adobe, should come with your TeX distribution
% \usepackage{minionpro}     % the MinionPro package for use with the Minion fonts from Adobe Reader
% %\usepackage{charter}     % another decent font if MinionPro isn't available
% \renewcommand*{\ttfamily}{\fontfamily{SourceCodePro-TOsF}\selectfont}

% Xe and Lua only
% font handling for Xe/LuaLaTeX
\usepackage{fontspec}    
\setmainfont[Ligatures=TeX,Numbers={OldStyle,Proportional}]{Minion Pro} 
\setsansfont[Ligatures=TeX,Numbers={OldStyle,Proportional},Scale=MatchLowercase]{Source Sans Pro}
\setmonofont[Ligatures=TeX,Scale=0.85]{Source Code Pro}
% how do I disable Minion's T_h ligature?

\definecolor{hks15k}{cmyk}{0.1,1,.8,0}   % #15 from the HKS palette
\definecolor{hks89k}{cmyk}{0,.1,.3,.35}  % #89 from the HKS palette


% font settings for headings
\setkomafont{section}{\normalfont\sffamily\large\bfseries\color{hks15k}}
\setkomafont{subsection}{\normalfont\sffamily\bfseries\color{hks15k}}
\setkomafont{subsubsection}{\normalfont\sffamily\bfseries\color{hks15k}}
\setkomafont{paragraph}{\normalfont\scshape}

% footer settings
\pagestyle{scrheadings}\clearscrheadfoot
\rofoot{\normalfont\thepage\hspace*{2\baselineskip}}

\setcounter{secnumdepth}{0}             % no section numbering
\setlength{\parindent}{2\baselineskip}  % larger paragraph indent

\frenchspacing                          % no extra space after full stop

% footnote settings
\makeatletter
  \deffootnotemark{\color{hks15k}\textsuperscript{\sffamily\bfseries\thefootnotemark}}
  \long\def\@makefntext#1{\leavevmode%
    {\sffamily\bfseries\color{hks15k}\@thefnmark\enskip}\nobreak
    \relax#1%
  }
\makeatother

\renewcommand{\blindmarkup}[1]{\emph{#1}}

\begin{document}
\blindtext\par\blindtext

\section{Lorem Ipsum}
\blindtext
\blindlist{enumerate}
\blindtext Footnote.\footnote{Knuth 1981: 123.}
\blindlist{itemize}
\blindtext Footnote.\footnote{\blindtext}
\blindtext\bigskip

\begin{mdframed}[hidealllines=true,backgroundcolor=hks89k!50]
\ttfamily
\begin{raggedright}
\blindtext\par
\end{raggedright}
\end{mdframed}

\blinddocument
\end{document}

相关内容