梅威瑟:
\documentclass[12pt,twocolumn]{article}
\usepackage{chessboard}
\usepackage{enumerate}
\usepackage[headheight=15pt,top=1.5cm,nofoot,bottom=0cm,left=1cm,right=1cm]{geometry}
\usepackage{fancyhdr}
\usepackage{lastpage}
\lfoot{}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
%% FONT
%\usepackage[T1]{fontenc}
%\usepackage[math]{iwona} %nice font
%% OWN command
\newcommand{\game}[3]{
\item \begin{tabular}[t]{l}
(#1 points) \\
\chessboard[
setfen= #3,
mover= #2
]
\end{tabular}
}
\begin{document}\raggedbottom
\pagestyle{fancy}
\begin{enumerate}[Q1.]
\lhead{Elementary Mates}
%% 01 - 06
\game{1}{w}{1k/pb3p/3p3r/3p3p/1R2rP/2R4B/PP4P/6K}
\game{1}{w}{5b/1pp/6pp/1P1k1p/2KPp/4P/rn2Nppp/2R3K}
\game{1}{b}{/1p2rk/p1pK1n/P/1P/7Q}
\game{1}{b}{4k/p4p//R2pPKPp/3P3P/7r}
\game{1}{w}{r2qkbnr/1p3ppp/p1n/2P/2bpN//PPP1QPPP/R1B1K1NR}
\game{1}{b}{/1p3k/4p1p/Pp2P/1b2qp/1K2Q1p/3B}
%% 07 - 12
\game{1}{b}{2r1r/6k/3pp1p/2n/1p3P//1PP/1NKQ}
\game{1}{w}{4B//3BK/r4pk//6PP}
\game{1}{w}{2r/p4p/4b2p/2p2p1P/2P1k1p/1PKN/P5P/3R}
\game{1}{w}{r1b4R/1p2pkb/p4p2/6pp/B/2N2q1P/PP3PP/4R1K}
\game{1}{w}{/r5p/4bp1p/1R2p1kP/4P1P/5PK}
\game{1}{w}{/5p1p//2B3b/5kP/1P1K1p1P}
\end{enumerate}
\end{document}
显然我的文件中有近 300 页。因此,每页都[xxxx]
需要大约半秒钟才能编译完成。我不知道为什么这么慢。
答案1
代码不太好。它使用了很多 \ifthenelse 开关和类似的东西,速度很慢。我只能为自己辩解说,在我编写它的时候,既没有 expl3 也没有 l3benchmark。所以,在我找到时间重写包之前,你将不得不忍受缓慢的处理。为了展示这两种方法的区别,这里有一些基准测试(第一次是旧代码,第二次是新代码):
\documentclass{article}
\usepackage{expl3,ifthen}
\usepackage{l3benchmark}
\newcommand\test{empty}
\newcommand\testref{empty}
\newcounter{ufcnt}
\begin{document}
\ExplSyntaxOn
\benchmark:n{
\ifthenelse%
{\equal{\test}{empty}}%
{\stepcounter{ufcnt}}%
{}}
\fp_use:N\g_benchmark_time_fp
\int_new:N\g_uf_tmpa_int
\benchmark:n{
\tl_if_eq:NNTF
\test\testref%
{\int_gincr:N\g_uf_tmpa_int}%
{}}
\par
\fp_use:N\g_benchmark_time_fp
\ExplSyntaxOff
\end{document}