我正在准备一份全面的讲义,其中将涵盖三门课程的相互关联的主题。这三门课程是:
- 课程一:主题基础(包括部分A和部分B)
- 课程 2:A 的详细信息
- 课程3:B 的详细信息
现在,我正在寻找一种标记课程 2 或 3 中独有的内容的可能性。您认为有哪些可能性可以说明这种内容分类?有哪些 LaTeX 软件包可用于此目的?
我考虑过在页边添加彩色条纹,在标题前添加彩色符号等。总的来说,我喜欢罗格朗橙皮书或者雅书,但我还没有看到他们提供这样的标记/类别。
一般来说,我需要一个目录,其中除了编号、标题和页面之外还有一个额外的类别。
期待阅读您的想法和创意!也许有人可以提供已经完成的类似想法的例子。谢谢!
答案1
代码已更新,我认为我的新答案更好;带有 bophook 的旧版本(过时的包)位于底部!
新代码
\documentclass{article} %% Book works aswell, I just don't like
\usepackage{blindtext} %% Just for testing
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{etoolbox} % provides if-else-conditionals
\usepackage{eso-pic} % provides the \AddToShipoutPictureBG command
%% TOPIC A
\def \currentTopicColor{white!100}
\newcommand{\Topic}[0]{
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [\currentTopicColor,line width=10pt] ($ (A) + (1cm,0.4cm) $) rectangle ($ (A) + (2cm,-40cm) $);
\end{tikzpicture}
}
\newcounter{brain}
\setcounter{brain}{0}
\newcounter{didWeJustChangePage}
\setcounter{didWeJustChangePage}{0} %Sæt 0 ved hver topic
\AddToHook {shipout/background}{
\ifodd\thebrain
{
\setcounter{didWeJustChangePage}{1}
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [\currentTopicColor,line width=0pt] ($ (A) + (1cm,0.4cm) $) rectangle ($ (A) + (2cm,-40cm) $);
\end{tikzpicture}
}
\else{
\setcounter{didWeJustChangePage}{1}
\setcounter{brain}{1}
}\fi
}
\newcommand{\previoustopicdrawing}{
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [yellow,line width=0pt] ($ (A) + (1cm,7cm) $) rectangle ($ (A) + (2cm,-0.4cm) $);
\end{tikzpicture}
}
\newcommand{\topicdrawing}[1]{
\ifodd\thedidWeJustChangePage
{
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [\currentTopicColor,line width=10pt] ($ (A) + (1cm,40cm) $) rectangle ($ (A) + (2cm,-0.4cm) $);
\fill [#1,line width=10pt] ($ (A) + (1cm,0.4cm) $) rectangle ($ (A) + (2cm,-40cm) $);
\end{tikzpicture}
}
\else{
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [#1,line width=10pt] ($ (A) + (1cm,0.4cm) $) rectangle ($ (A) + (2cm,-40cm) $);
\end{tikzpicture}
}\fi
}
\def \TopicAColor{orange!20}
\def \TopicBColor{green!20}
\def \TopicCColor{red!20}
\def \TopicDColor{blue!20}
\def \TopicFColor{yellow!20}
\newcommand{\TopicA}{
\topicdrawing{\TopicAColor}
\def \currentTopicColor{\TopicAColor}
\setcounter{brain}{0}
\setcounter{didWeJustChangePage}{0}
}
\newcommand{\TopicB}{
\topicdrawing{\TopicBColor}
\def \currentTopicColor{\TopicBColor}
\setcounter{brain}{0}
\setcounter{didWeJustChangePage}{0}
}
\newcommand{\TopicC}{
\topicdrawing{\TopicCColor}
\def \currentTopicColor{\TopicCColor}
\setcounter{brain}{0}
\setcounter{didWeJustChangePage}{0}
}
\newcommand{\TopicD}{
\topicdrawing{\TopicDColor}
\def \currentTopicColor{\TopicDColor}
\setcounter{brain}{0}
\setcounter{didWeJustChangePage}{0}
}
\newcommand{\TopicF}{
\topicdrawing{\TopicFColor}
\def \currentTopicColor{\TopicFColor}
\setcounter{brain}{0}
\setcounter{didWeJustChangePage}{0}
}
\newcommand{\TopicRemove}{
\topicdrawing{white!100}
\def \currentTopicColor{white!100}
\setcounter{brain}{0}
\setcounter{didWeJustChangePage}{0}
}
\begin{document}
\tableofcontents
\section{Fundamental of Topic (including some A and some B)}
\TopicF
\subsection{Here is some text about fundamental}
\noindent\blindtext[2]
\bigskip\par
\TopicA
\subsection{Here is some text about topic A}
\noindent \blindtext[2] \par
\TopicB
\subsection{Here is some text about topic B}
\blindtext[2] \par
\TopicRemove
\par
\subsection{Here is some text with no topic}
\blindtext[3] \par
\TopicB
\subsection{Here is some more text about topic B}
\blindtext[2] \par
\end{document}
MWE 的输出
带有过时软件包的旧代码 我不太清楚您想要用目录做什么,但是您可以使用一堆不同的包在页边空白处制作彩色条纹。下面是示例代码,但首先看看代码的输出。
\documentclass{article} %% Book works aswell, I just don't like
\usepackage{blindtext} %% Just for testing
%% NOT IMPORTANT BUT I JUST NEED
\usepackage{fancyhdr}
\usepackage{lastpage}
\newcommand{\titlesetup}[4]{
\title{#2 }
\author{af #1}
\date{#3}
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{15pt}
\fancyhead[L]{#4}
\fancyhead[R]{#2}
\fancyfoot[R]{\thepage}
\fancypagestyle{plain}{
\fancyhf{}
\rfoot{\thepage}
} }
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{etoolbox} % provides if-else-conditionals
\usepackage{eso-pic} % provides the \AddToShipoutPictureBG command which adds content to background of every page
\usepackage{bophook} %% Lader os gøre det på hver side
\newtoggle{TopicA} % default: deactivated
\AddToShipoutPictureBG{% this command adds content to background of every page
\iftoggle{TopicA}{
\AtBeginPage{\TopicA}
}{%else, but we need no else ;)
}}
\newtoggle{TopicE} % default: deactivated
\AddToShipoutPictureBG{% this command adds content to background of every page
\iftoggle{TopicE}{
\AtBeginPage{\TopicE}
}{%else, but we need no else ;)
}}
\newtoggle{TopicD} % default: deactivated
\AddToShipoutPictureBG{% this command adds content to background of every page
\iftoggle{TopicD}{
\AtBeginPage{\TopicD}
}{%else, but we need no else ;)
}}
\newtoggle{NOTOPIC} % default: deactivated
\AddToShipoutPictureBG{% this command adds content to background of every page
\iftoggle{NOTOPIC}{
\AtBeginPage{\TopicRemove}
}{%else, but we need no else ;)
}}
%% TOPIC D
\newcommand{\TopicD}[0]{
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [blue!20,line width=10pt] ($ (A) + (1cm,0.4cm) $) rectangle ($ (A) + (2cm,-40cm) $);
\end{tikzpicture}
\TR
\toggletrue{TopicD} %% Toggle D on
}
%% TOPIC A
\newcommand{\TopicA}[0]{
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [orange!20,line width=10pt] ($ (A) + (1cm,0.4cm) $) rectangle ($ (A) + (2cm,-40cm) $);
\end{tikzpicture}
\TR %% Toggles all other enviroments off
\toggletrue{TopicA} %% Toggle A on
}
%% TOPIC E
\newcommand{\TopicE}[0]{
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [green!20,line width=10pt] ($ (A) + (1cm,0.4cm) $) rectangle ($ (A) + (2cm,-40cm) $);
\end{tikzpicture}
\TR
\togglefalse{NOTOPIC}
}
\newcommand{\TR}[0]{
\togglefalse{TopicA}
\togglefalse{TopicD}
\togglefalse{TopicE}
\togglefalse{NOTOPIC}
}
\newcommand{\TopicRemove}[0]{
\TR
\toggletrue{NOTOPIC}
\begin{tikzpicture}[remember picture,overlay]
\path[draw=black] let \p1 = ($ (current page.west)$) in node(A) at (\x1,0) {};
\fill [white!100,line width=0pt] ($ (A) + (1cm,0.4cm) $) rectangle ($ (A) + (2cm,-40cm) $);
\end{tikzpicture}
}
\begin{document}
\titlesetup{Test of Test}{Test}{Test}{Test}
\tableofcontents
\section{Fundamental of Topic (including some A and some B)}
\TopicD
\subsection{Here is some text about fundamental}
\noindent\blindtext[2]
\bigskip\par
\TopicA
\subsection{Here is some text about topic A}
\noindent \blindtext[2] \par
\TopicE
\subsection{Here is some text about topic B}
\blindtext[2] \par
\TopicRemove
\par
\subsection{Here is some text with no topic}
\blindtext[3] \par
\TopicA
\subsection{Here is some more text about topic B}
\blindtext[2] \par
\end{document}
发现了一些“灵感”,可能有助于解释一些事情:):
彩色边距 如何为某些页面设置彩色边距?
Tikz一个坐标 TikZ:节点与另一个节点位于相同的 x 坐标,但指定了 y 坐标?
在页面开始处做一些事情(制作彩色边距) 在每一页开始时执行一条命令
电子工具包 http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/etoolbox/etoolbox.pdf#page=3&zoom=100,0,0