Debian Codegraph @

texmf-dist/doc/latex/ximera/src/title.dtx

raw
1 % \subsubsection{Titles and authors}
2 %
3 % \subsubsection{Authors}
4 % \DescribeMacro{\author}{Activities have authors. Warn the user if no author is provided.}
5 % \begin{macrocode}
6 %<*classXimera>
7 \let\@emptyauthor\@author
8 \def\author#1{\gdef\@author{#1}}
9 \def\@author{\@latex@warning@no@line{No \noexpand\author given}}
10 %</classXimera>
11 % \end{macrocode}
12 % Include author name in meta tags
13 % \begin{macrocode}
14 %<*htXimera>
15 \Configure{@HEAD}{\HCode{<meta name="author" content="}\@author\HCode{" />\Hnewline}}
16 %</htXimera>
17 % \end{macrocode}
18 % The |\and| command would emit tabular environments which really
19 % should not appear in a meta tag.
20 % \begin{macrocode}
21 %<htXimera|classXimera>\def\and{and }
22 % \end{macrocode}
23
24 % \subsubsection{Title}
25 % \DescribeMacro{\title}{Activities have titles.}
26 % \begin{macrocode}
27 %<*classXimera>
28 \let\title\relax
29 \newcommand{\title}[1][]{{\protected@xdef\@pretitle{#1}}\protected@xdef\@title}
30
31 \title{}
32
33 \newcounter{titlenumber}
34 \renewcommand{\thetitlenumber}{\arabic{titlenumber}}
35 %\renewcommand{\thesection}{\arabic{titlenumber}} %% Makes section numbers work
36 \setcounter{titlenumber}{0}
37
38 \newpagestyle{main}{
39 \sethead[\textsl{\ifnumbers\thetitlenumber\hspace{1em}\fi\@title}][][] % even
40 {}{}{\textsl{\ifnumbers\thetitlenumber\hspace{1em}\fi\@title}} % odd
41 \setfoot[\thepage][][] % even
42 {}{}{\thepage} % odd
43 }
44 \pagestyle{main}
45 % \end{macrocode}
46 % \DescribeMacro{\maketitle}{In a \textsf{ximera} document, redefine
47 % |\maketitle| and put them in a table of contents. The
48 % |\phantomsection| is to fix the hrefs.}
49 % \begin{macrocode}
50 \renewcommand\maketitle{%
51 \addtocounter{titlenumber}{1}%
52 {\flushleft\large\bfseries \@pretitle\par\vspace{-1em}}
53 {\flushleft\LARGE\bfseries {\ifnumbers\thetitlenumber\fi}{\ifnumbers\hspace{1em}\else\hspace{0em}\fi}\@title \par }
54 \phantomsection%
55 \ifnumbers\addcontentsline{toc}{section}{\thetitlenumber~\@title}\else\addcontentsline{toc}{section}{\@title}\fi
56 \vskip .6em\noindent\textit\theabstract\setcounter{problem}{0}\setcounter{section}{0}\setcounter{subsection}{0}\par\vspace{2em}
57 \ifnooutcomes\else\let\thefootnote\relax\footnote{Learning outcomes: \theoutcomes}\fi
58 \ifnoauthor\else\let\thefootnote\relax\footnote{Author(s):~\@author}\fi
59 \aftergroup\@afterindentfalse
60 \aftergroup\@afterheading}
61
62 \ifnumbers
63 \setcounter{secnumdepth}{2}
64 \renewcommand{\thesection}{\arabic{titlenumber}.\arabic{section}}
65 \renewcommand{\thesubsection}{\arabic{titlenumber}.\arabic{section}.\arabic{subsection}}
66 \else
67 \setcounter{secnumdepth}{-2}
68 \fi
69
70 \def\activitystyle{}
71 \newcounter{sectiontitlenumber}
72 \setcounter{secnumdepth}{2}
73 \setcounter{tocdepth}{2}
74 \newcommand\chapterstyle{%
75 \def\activitystyle{activity-chapter}
76 \def\maketitle{%
77 \addtocounter{titlenumber}{1}%
78 {\flushleft\small\sffamily\bfseries\@pretitle\par\vspace{-1.5em}}%
79 {\flushleft\LARGE\sffamily\bfseries\thetitlenumber\hspace{1em}\@title \par }%
80 {\vskip .6em\noindent\textit\theabstract\setcounter{problem}{0}\setcounter{section}{0}}%
81 \par\vspace{2em}
82 \phantomsection\addcontentsline{toc}{section}{\textbf{\thetitlenumber\hspace{1em}\@title}}%
83 }}
84
85
86 \newcommand\sectionstyle{%
87 \def\activitystyle{activity-section}
88 \def\maketitle{%
89 \addtocounter{section}{1}
90 \setcounter{sectiontitlenumber}{\value{section}}
91 {\flushleft\small\sffamily\bfseries\@pretitle\par\vspace{-1.5em}}%
92 {\flushleft\Large\sffamily\bfseries\thetitlenumber.\thesectiontitlenumber\hspace{1em}\@title \par}%
93 {\vskip .6em\noindent\textit\theabstract\setcounter{subsection}{0}}%
94 \par\vspace{2em}
95 \phantomsection\addcontentsline{toc}{section}{\thetitlenumber.\thesectiontitlenumber\hspace{1em}\@title}%
96 \renewcommand\section{\@startsection{subsection}{2}{\z@}%
97 {-3.25ex\@plus -1ex \@minus -.2ex}%
98 {1.5ex \@plus .2ex}%
99 {\normalfont\large\bfseries}}
100
101 \renewcommand\subsection{\@startsection{subsubsection}{3}{\z@}%
102 {-3.25ex\@plus -1ex \@minus -.2ex}%
103 {1.5ex \@plus .2ex}%
104 {\normalfont\normalsize\bfseries}}
105
106 }}
107
108
109 \iftikzexport%% allows xake to handle \chapterstyle and \sectionstye
110 \renewcommand\chapterstyle{\def\activitystyle{chapter}}
111 \renewcommand\sectionstyle{\def\activitystyle{section}}
112 \else
113 \fi
114
115 %</classXimera>
116 % \end{macrocode}
117 % Eliminate some formatting that we'll handle later with CSS
118 % \begin{macrocode}
119 %<*htXimera>
120 \renewcommand{\maketitle}{}
121 %</htXimera>
122 % \end{macrocode}