Skip to content

Commit

Permalink
Add index to the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Aug 26, 2021
1 parent cbccf36 commit 3ee5a99
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
1 change: 1 addition & 0 deletions latexmkrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$pdflatex = 'lualatex --shell-escape %O %S';
$makeindex = 'makeindex -s %R.ist %O -o %D %S';
$pdf_mode = 1;
$postscript_mode = 0;
$dvi_mode = 0;
46 changes: 34 additions & 12 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,50 @@

% Define some markup.
\let\pkg\relax % A package name
\def\inline#1{% Inline code
\textcolor{spot}{\text{\texttt{#1}}}}
\newcommand\acro[1]{% An acronym
\textsc{\MakeLowercase{#1}}}

% Set up index.
\DisableCrossrefs
\IndexPrologue{%
\section*{\indexname}%
\addcontentsline{toc}{section}{\indexname}}
\makeatletter\c@IndexColumns=2\makeatother
\usepackage{makeidx}
\makeindex

\newcommand\mdef[1]{% A TeX macro definition
\index{#1@\cs{#1}|textit}%
\phantomsection\label{macro:#1}\textcolor{spot}{\cs{#1}}}
\newcommand\m[1]{% A TeX macro reference
\index{#1@\cs{#1}}%
\hyperref[macro:#1]{\textcolor{spot}{\cs{#1}}}}
\newcommand\envmdef[1]{% A TeX macro definition
\phantomsection\label{environment:#1}\t`#1`}

\newcommand\envmdef[1]{% A LaTeX environment definition
\index{#1@\texttt{#1}|textit}%
\phantomsection\label{environment:#1}\inline{#1}}
\newcommand\envm[1]{% A LaTeX environment reference
\hyperref[environment:#1]{\t`#1`}}
\index{#1@\texttt{#1}}%
\hyperref[environment:#1]{\inline{#1}}}

\newcommand\luamdef[1]{% A Lua object / method definition
\phantomsection\label{lua:#1}\t`#1`}
\index{#1@\texttt{#1}|textit}%
\phantomsection\label{lua:#1}\inline{#1}}
\newcommand\luam[1]{% A Lua object / method reference
\hyperref[lua:#1]{\t`#1`}}
\def\inline#1{% Inline code
\textcolor{spot}{\text{\texttt{#1}}}}
\def\t`#1`{\inline{#1}}
\index{#1@\texttt{#1}}%
\hyperref[lua:#1]{\inline{#1}}}

\newcommand\Optitem[2][]{\penalty -1000\relax % An option item definition
\index{#2@\texttt{#2}|textit}%
\phantomsection\label{opt:#2}\optitem[#1]{#2}}
\newcommand\Valitem[2][]{\penalty -1000\relax % A value item definition
\index{#2@\texttt{#2}}%
\phantomsection\label{opt:#2}\valitem[#1]{#2}}
\newcommand\Opt[1]{% An option / value item reference
\hyperref[opt:#1]{\t`#1`}}
\newcommand\acro[1]{% An acronym
\textsc{\MakeLowercase{#1}}}
\index{#1@\texttt{#1}}%
\hyperref[opt:#1]{\inline{#1}}}

% Set up markdown.
\usepackage[
Expand Down Expand Up @@ -366,7 +387,8 @@
\printtitlepage
\tableofcontents
\DocInput{markdown.dtx}
\printbibliography
\printbibliography[heading=bibintoc]
\printindex
\end{document}
%</driver>
%<*manual-css>
Expand Down
3 changes: 3 additions & 0 deletions markdown.ist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
delim_0 "\\hfill"
delim_1 "\\hfill"
delim_2 "\\hfill"

0 comments on commit 3ee5a99

Please sign in to comment.