双栏快速参考

双栏快速参考

Pramod Achar 的关于 perverse sheaves 的书后面有一个快速参考,如下所示。我如何才能实现类似的效果?对我来说重要的是:一般间距(尽管我可能更喜欢外面的边距较少)、两列、编号和标签、水平线分隔符。对于语言,我只关心英语。我没有任何字体偏好。

在此处输入图片描述

答案1

这是解决您的问题的一种方法:

  • 第 1 部分:照常撰写文本,使用\section\subsection
  • 第 2 部分:使用\twocolumn自己的命令替换部分\qrs内容\qrsub
  • 第 3 部分:与第 2 部分相同,但使用\onecolumnANDpackage multicol

完成第 1 部分后,另请参阅下面代码中的此注释:

评论

这里最有趣的部分可能在开始处:计数器和自己的命令的定义和使用。

定义计数器并将其初始化为 0 很简单:

\newcounter{cqr}%       counting "sections"
\setcounter{cqr}{0}
\newcounter{csqr}%      counting "subsections"
\setcounter{csqr}{0}

\section可以通过例如以下方式进行替换,其中\thecqr返回 counter 的值cqr,其余的只是根据需要排版,并#1保留您将传递的标题:

\newcommand\qrs[1]{%    acting as "section"
    \stepcounter{cqr}%  increment "section"-number
    \setcounter{csqr}{0}%
    \begin{center}%
        \textbf{QR\thecqr. #1}%
    \end{center}%
}

请注意,在增加“section”时会初始化“subsections”替换的计数器。现在,subsection替换看起来非常相似,但排版略有不同:

\newcommand\qrsub[1]{%  acting as "subsection"
    \stepcounter{csqr}%
    \begin{flushleft}%
        \hrule%
        \bigskip%
        \textbf{QR\thecqr.\thecsqr\ }(#1)%
    \end{flushleft}%
}

(PS:很多%都是必要的。)

就我个人而言,我可能更喜欢单列/多列方法,而不是双列方法。

结果

\documentclass[10pt,a4paper]{article}
\usepackage{lipsum}
\usepackage{multicol}

% ~~~ QR-"sections" and "subsections" ~~~
\newcounter{cqr}%       counting "sections"
\setcounter{cqr}{0}
\newcounter{csqr}%      counting "subsections"
\setcounter{csqr}{0}

\newcommand\qrs[1]{%    acting as "section"
    \stepcounter{cqr}%  increment "section"-number
    \setcounter{csqr}{0}%
    \begin{center}%
        \textbf{QR\thecqr. #1}%
    \end{center}%
}

\newcommand\qrsub[1]{%  acting as "subsection"
    \stepcounter{csqr}%
    \begin{flushleft}%
        \hrule
        \bigskip
        \textbf{QR\thecqr.\thecsqr\ }(#1)%
    \end{flushleft}%
}

% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
 Strategy: start small, refine later

% PART 1 
    % ------------------------------
    \section{Triangulated categories} 
     \subsection{Distinguished triangles}
     Write some math-text here, like $a^2 + b^2 = c^2$, which you can also list as:
     
     \begin{itemize}
       \item case 1: $c^2 \in R$
       \item case 2: $c^2 \in C$
     \end{itemize}
     
     \subsection{Canonical functions}
      Same as above. $E = m c^2$. Same as above. Same as above. $E = h \nu$. Same as above. 
    
    % ------------------------------
    \section{Sheaves}
     \lipsum[4]
     \subsection{The six operations}
     Same as above.

% ~~~~~~~~~~~~~~~~~
\bigskip 
\fbox{Now let's try some things:}

\begin{itemize}
  \item using twocolumn and setting columnwidth
  \item using self-defined qrs to replace sections and counter cqr
  \item using self-defined qrsub to replace subsections and counter csqr
  \item use onecolumn and package multicol
\end{itemize}

 
% ~~~ now let's copy and introduce changes ~~~~~
% PART 2 
\twocolumn[\begin{center}%
\huge{\textbf{Quick reference}}%
\end{center}]%          starts a new page in two columns
\setlength{\columnwidth}{4cm}

    % ------------------------------
    \qrs{Triangulated categories} 
     \qrsub{Distinguished triangles}
     Write some math-text here, like $a^2 + b^2 = c^2$, which 
     you can also list as:
     
     \begin{itemize}
       \item case 1: $c^2 \in R$
       \item case 2: $c^2 \in C$
     \end{itemize}
     
     \qrsub{Canonical functions}
      Same as above. $E = m c^2$. Same as above. Same as 
      above. $E = h \nu$. Same as above. 
    
    % ------------------------------
    \qrs{Sheaves}
     \lipsum[4]
     \qrsub{The six operations}
     Same as above.
    
    To fill the rest of the page:
    \lipsum[1-2]


% ~~~ now let's use onecolumn and multicol ~~~~~
% PART 3 
\onecolumn%             starts a new page in one column

\begin{center}%
\huge{\textbf{Quick reference}}%
\end{center}
\vspace{5mm}

\setcounter{cqr}{0}%            resetting the QR-counter
\setlength{\columnsep}{3cm}
\begin{multicols}{2}
    % ------------------------------
    \qrs{Triangulated categories} 
     \qrsub{Distinguished triangles}
     Write some math-text here, like $a^2 + b^2 = c^2$, 
     which you can also list as:
     
     \begin{itemize}
       \item case 1: $c^2 \in R$
       \item case 2: $c^2 \in C$
     \end{itemize}
     
     \qrsub{Canonical functions}
      Same as above. $E = m c^2$. Same as above. 
      Same as above. $E = h \nu$. Same as above. 
    
    % ------------------------------
    \qrs{Sheaves}
     \lipsum[4]
     \qrsub{The six operations}
     Same as above.
    
    To fill the rest of the page:
    \lipsum[1]
\end{multicols}
 
\end{document}

相关内容