summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/crumbs/crumbs.tex
blob: ce34e8c6503e74000ecaa29f1cf58189633a8bd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
% (The MIT License)
%
% Copyright (c) 2021 Yegor Bugayenko
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the 'Software'), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in all
% copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
% SOFTWARE.

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[tt=false,type1=true]{libertine}
\usepackage{ffcode}
\usepackage{xcolor}
\usepackage{crumbs}
\usepackage{fancyhdr}
  \fancyhf{}
  \setlength{\headheight}{1.2in}
  \renewcommand{\headrulewidth}{1pt}
  \renewcommand\crumb[2]{{\sffamily[{\ifnum\value{section}=\value{crumbi}\color{orange}\fi#1}]\quad}}
  \renewcommand\subcrumb[2]{{\sffamily[{\ifnum\value{subsection}=\value{subcrumbi}\color{orange}\fi#1}]$\;$}}
  \fancyhead[L]{
    \ff{\char`\\crumbs}: \crumbs
    \\[3pt]
    \small\ff{\char`\\subcrumbs}: \subcrumbs
    \\[3pt]
    \footnotesize\ttfamily section=\the\value{section}, crumbi=\the\value{crumbi}, subcrumbi=\the\value{subcrumbi}
  }

\title{\ff{crumbs}: \LaTeX{} Package \\ for Navigation Crumbs}
\author{Yegor Bugayenko}
\date{0.2.2 2021/09/09}

\begin{document}
\pagenumbering{gobble}
\raggedbottom
\setlength{\parindent}{0pt}
\setlength{\columnsep}{32pt}
\setlength{\parskip}{6pt}

\maketitle
\pagestyle{fancy}
\thispagestyle{fancy}

Before the first \ff{\char`\\section} command:

\ff{\char`\\crumbs}: \crumbs
\\[3pt]
\small\ff{\char`\\subcrumbs}: \subcrumbs

\section[Intro]{Introduction}

This package helps you add navigation crumbs to your document,
which is most useful for presentation and slide decks:

\begin{ffcode}
\documentclass{article}
\usepackage{crumbs}
\usepackage{fancyhdr}
  \fancyhf{}
  \pagestyle{fancy}
  \fancyhead[L]{\crumbs / \subcrumbs}
\begin{document}
\section{Introduction}
Some text here.
\section{Related Works}
Some other text here.
\end{document}
\end{ffcode}

You may redefine \ff{\char`\\crumb\{\}} and \ff{\char`\\subcrumb\{\}}
commands, if you want your crumbs to look nicer, for example:

\begin{ffcode}
\renewcommand\crumb[2]{
  {
    \ifnum\value{section}=\value{crumbi}
      \color{orange}
    \fi
    #1
  }
}
\end{ffcode}

The same for \ff{\char`\\subcrumb\{\}}, but the comparison should be
done not between \ff{section} and \ff{crumbi}, but between
\ff{subsection} and \ff{subcrumbi} counters.

The first parameter of both \ff{\char`\\crumb\{\}} and \ff{\char`\\subcrumb\{\}}
is the optional parameter of \ff{\char`\\section\{\}} and \ff{\char`\\subsection\{\}}
calls respectively. The second one is the mandatory parameter of them, which
is the full text of the section and sub-section.

You can use \ff{\char`\\section} and \ff{\char`\\subsection} with
an optional argument, which will be used in the crumbs, e.g.:

\begin{ffcode}
\section[Details]{More Details About The Method}
\subsection[SLR]{Systematic Literature Review}
\end{ffcode}

\subsection{How to Contribute}

More details about this package you can find
in the \ff{yegor256/crumbs} GitHub repository.

If you want to add a feature or fix a bug, you are welcome
to submit an issue or make a pull request.

\section{How It Works}

On the first run, a new file \ff{\char`\\jobname.crumbs} is created,
where all \ff{\char`\\section} and \ff{\char`\\subsection} commands
are being logged.

On the second run, the file is loaded and two commands are being
created: \ff{\char`\\crumbs} and \ff{\char`\\subcrumbs}. The first
one is a collection of \ff{\char`\\crumb\{\}} calls, while the second
one is a collection of \ff{\char`\\subcrumb\{\}} ones.

\end{document}