add LM 5 hw, caryatid
[light-and-matter.git] / lmenvironments.sty
blob1e6d1023662da1c062befd354f4da38243260829
1 % lmenvironments.sty
2 % This is meant to be used by all the books. Nothing specific to the LM
3 % series should go in here.
4 %-------------------- eg environment -------------------
5 \newlength{\egindent}
6 \setlength{\egindent}{3mm}
7 \newlength{\saveleftskip}
8 \newcommand{\myindented}[2]{%
9 \setlength{\saveleftskip}{\leftskip}%
10 \addtolength{\leftskip}{#1}#2%
11 \par \setlength{\leftskip}{\saveleftskip} \par%
13 \definecolor{egrulegray}{gray}{.6}
14 \newlength{\egrulehspace}
15 \setlength{\egrulehspace}{.5mm}
16 \newlength{\egrulelen}
17 \setlength{\egrulelen}{110.5mm}
18 \newcommand{\egrule}[1]{\makebox[0mm][l]{\color{egrulegray}\rule{#1}{0.5pt}}}
19 \newcommand{\egvrule}{\makebox[0mm][l]{\color{egrulegray}\rule{0.5pt}{2mm}}}
20 \newcommand{\egbothrules}[1]{\makebox[0mm][l]{\hspace{-0.5mm}\raisebox{1.5mm}{\egvrule}\raisebox{3.5mm}{\egrule{#1}}}}
21 \newcommand{\egtit}[2]{\egbothrules{#1}\textit{\hspace{\egrulehspace}#2\hfill{}\langexample{} \theegctr}}
22 \newcommand{\baretit}[1]{\egbothrules{\egrulelen}\textit{\hspace{\egrulehspace}#1}}
23 \newenvironment{eg}[2][3]
25 \refstepcounter{egctr}%
26 \setlength{\saveleftskip}{\leftskip}%
27 \addtolength{\leftskip}{\egindent}%
28 \sffamily
29 \pagebreak[#1]\noindent\egtit{\egrulelen}{#2}\\*\noindent\myeqnspacing\protect\sansmath%
30 \indentedcorrstart% for margdown
31 \setlength{\parindent}{0mm}%undone by normalparafmt
34 \normalparafmt
35 \lmserifmath\par\setlength{\leftskip}{\saveleftskip} \par\myeqnspacing%
36 \indentedcorrend%
38 \newenvironment{egwide}[2][3]
40 \noindent\begin{minipagefullpagewidth}
41 \refstepcounter{egctr}%
42 \setlength{\saveleftskip}{\leftskip}%
43 \addtolength{\leftskip}{\egindent}%
44 \small\sffamily
45 \pagebreak[#1]\noindent\egtit{169mm}{#2}\\*\noindent\myeqnspacing\protect\sansmath%
46 \indentedcorrstart% for margdown
47 \setlength{\parindent}{0mm}%undone by normalparafmt
50 \normalparafmt
51 \lmserifmath\par\setlength{\leftskip}{\saveleftskip} \par\myeqnspacing%
52 \indentedcorrend%
53 \end{minipagefullpagewidth}
55 \newcommand{\xmark}{\anonymousinlinefig{x-mark}}
56 \newenvironment{egnoheader}
58 \setlength{\saveleftskip}{\leftskip}%
59 \addtolength{\leftskip}{\egindent}%
60 \small\sffamily
61 \noindent\protect\sansmath\noindent%
62 \indentedcorrstart% for margdown
63 \noindent
66 \lmserifmath\par\setlength{\leftskip}{\saveleftskip} \par\myeqnspacing%
67 \indentedcorrend%
69 \newcommand{\egquestion}{\noindent\ensuremath{\triangleright}\ }
70 \newcommand{\eganswer}{\noindent\ensuremath{\triangleright}\ }
71 \newenvironment{likeeg}
73 \setlength{\saveleftskip}{\leftskip}%
74 \addtolength{\leftskip}{\egindent}%
75 \small\sffamily\noindent
78 \par\setlength{\leftskip}{\saveleftskip} \par%
80 \newcommand{\optionaltopictit}[1]{\egbothrules{\egrulelen}\textbf{\hspace{\egrulehspace}#1}}
81 \renewcommand{\thescctr}{\Alph{scctr}}
82 \newcommand{\scansref}[1]{$\triangleright$\ Answer, p. \pageref{scans:#1}}
83 \newcommand{\whichsc}{}
84 \newenvironment{selfcheck}[1]
86 \refstepcounter{scctr}\label{sc:#1}\renewcommand{\whichsc}{#1}%
87 \setlength{\saveleftskip}{\leftskip}%
88 \addtolength{\leftskip}{\egindent}%
89 \small\sffamily
90 \noindent\hspace{-1mm}%
91 %\egbothrules{\egrulelen}%
92 \hspace{\egrulehspace}%
93 \textit{\langselfcheck{}\ \thescctr}\\*\noindent\myeqnspacing\protect\sansmath%
94 \setlength{\parindent}{0mm}%undone by normalparafmt
97 \normalparafmt
98 \hfill\scansref{\whichsc}\normalsize\normalfont\lmserifmath\par\setlength{\leftskip}{\saveleftskip} \par\myeqnspacing%
100 \newcommand{\worked}[2]
102 \small\sffamily
103 \vspace{1.5mm}\noindent\hspace{3.5mm}\hwtriangle\ \textit{Solved problem: #2\hfill{}page \pageref{hw:#1}, problem \ref{hw:#1}}
104 \lmserifmath\par\normalsize\normalfont %\par %
106 % The following is meant for a long block of text appearing inside <% marg() %>...<% end_marg %>
107 \newenvironment{margtopic}[1] % args is title
109 \begin{sloppypar}
110 \small\sffamily\myeqnspacing\protect\sansmath%
111 \textbf{#1}\\
114 \end{sloppypar}
115 \lmserifmath\normalsize\normalfont %
117 % optional topics have titles with initial caps -- not any more???
118 \newenvironment{optionaltopic}[2][3]
120 \setlength{\saveleftskip}{\leftskip}%
121 \addtolength{\leftskip}{\egindent}%
122 \small\sffamily
123 \pagebreak[#1]\noindent\optionaltopictit{#2}\\*\noindent\myeqnspacing\protect\sansmath%
126 \lmserifmath\par\setlength{\leftskip}{\saveleftskip} \par\myeqnspacing%
128 \newenvironment{offsettopic}[1][3]
130 \pagebreak[#1]
131 \setlength{\saveleftskip}{\leftskip}%
132 \addtolength{\leftskip}{\egindent}%
133 \small\sffamily
134 \noindent\myeqnspacing\protect\sansmath%
135 \hspace{-5mm}%***************** KLUDGE *****************
138 \lmserifmath\par\setlength{\leftskip}{\saveleftskip} \par\myeqnspacing%
140 \newenvironment{longquote}
142 \setlength{\saveleftskip}{\leftskip}%
143 \addtolength{\leftskip}{\egindent}%
144 \small
145 \myeqnspacing\protect\sansmath\noindent%
148 \lmserifmath\par\setlength{\leftskip}{\saveleftskip} \par\myeqnspacing%
150 \newenvironment{dialogline}[1]%
152 \setlength{\saveleftskip}{\leftskip}%
153 \addtolength{\leftskip}{10mm}%
154 \noindent{}\sffamily\protect\sansmath%
155 {\scshape{#1}: }
157 \par \setlength{\leftskip}{\saveleftskip} \par%
158 \lmserifmath
160 \newcommand{\labelimportantintext}[1]{\textbf{#1}}
161 % The optional argument is a title, which should be lowercase.
162 \newenvironment{important}[1][]%
163 {\begin{shaded}\ifthenelse{\equal{#1}{}}{}{\textbf{#1}\\*}}%
164 {\end{shaded}}
165 \newenvironment{lessimportant}[1][]%
167 \setlength{\saveleftskip}{\leftskip}%
168 \addtolength{\leftskip}{10mm}%
169 \noindent\ifthenelse{\equal{#1}{}}{}{\textbf{#1}\\*}%
171 \par \setlength{\leftskip}{\saveleftskip} \par%
173 \newenvironment{indentedblock}%
175 \setlength{\saveleftskip}{\leftskip}%
176 \addtolength{\leftskip}{10mm}%
177 \noindent\hspace{-1.5mm}% kludge !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
179 \par \setlength{\leftskip}{\saveleftskip} \par%