comparison dottes.tex @ 312:8bc92e044e0a

Move tune and first line inclusion code into macros. Also use tune title, not name, as hyperlink targets. This removes the need to pass the name into the macros.
author Jim Hague <jim.hague@acm.org>
date Fri, 12 Jul 2013 11:36:14 +0100
parents dd4582ddbbf8
children b4d568b70c33
comparison
equal deleted inserted replaced
311:dd4582ddbbf8 312:8bc92e044e0a
5 \usepackage[margin=1in]{geometry} 5 \usepackage[margin=1in]{geometry}
6 \usepackage{graphicx} 6 \usepackage{graphicx}
7 \usepackage{fancyhdr} 7 \usepackage{fancyhdr}
8 \usepackage{longtable} 8 \usepackage{longtable}
9 \usepackage[UKenglish]{babel} 9 \usepackage[UKenglish]{babel}
10 \usepackage[UKenglish]{isodate} 10 %\usepackage[UKenglish]{isodate}
11 11
12 % Non-indented paragraphs with space between them. 12 % Non-indented paragraphs with space between them.
13 \usepackage{parskip} 13 \usepackage{parskip}
14 14
15 % 2 column table of contents. 15 % 2 column table of contents.
25 urlcolor=black 25 urlcolor=black
26 } 26 }
27 27
28 % ----- Common variables 28 % ----- Common variables
29 29
30 \def \build {\input{buildno.txt}} 30 \newcommand{\build}{\input{buildno.txt}}
31 \def \instrument {\input{instrument.txt}} 31 \newcommand{\instrument}{\input{instrument.txt}}
32 32
33 % Havoc purple is #9900cc. 33 % Havoc purple is #9900cc.
34 \definecolor{havocpurple}{rgb}{0.597,0,0.797} 34 \definecolor{havocpurple}{rgb}{0.597,0,0.797}
35
36 % ----- Macros
37
38 \makeatletter
39 \def\ifemptyarg#1{%
40 \if\relax\detokenize{#1}\relax % H. Oberdiek
41 \expandafter\@firstoftwo
42 \else
43 \expandafter\@secondoftwo
44 \fi}
45 \makeatother
46
47 % Show the main tune graphic and optional change.
48 % Args are change title (optional), tune title, tune graphic filename.
49 \newcommand{\showtune}[3][]{%
50 \vfill
51 \begin{center}
52 \phantomsection
53 \hypertarget{#2}{%
54 \includegraphics[width=\textwidth,height=0.85\textheight,keepaspectratio]{#3}
55 }
56 \addcontentsline{toc}{section}{#2}
57 \end{center}
58 \ifemptyarg{#1}{}{%
59 Change: \hyperlink{#1}{#1}
60 }%
61 }
62
63 % Show the tune first line. Generate table row.
64 % Args are the tune title and the first line graphic filename.
65 \newcommand{\showfirstline}[2]{%
66 \hyperlink{#1}{#1} & %
67 \raisebox{-.25\height}{\includegraphics[width=0.65\textwidth,height=1.3cm]{#2}} \\
68 }
35 69
36 % ----- Paper size document setup 70 % ----- Paper size document setup
37 71
38 \input{docsetup.tex} 72 \input{docsetup.tex}
39 73