Debian Codegraph @

texmf-dist/doc/latex/hideanswer/hideanswer-doc.tex

raw
1 \documentclass[%
2 fleqn,%
3 paper=a4paper,%
4 fontsize=10pt,%
5 open_bracket_pos=zenkakunibu_nibu,%
6 hanging_punctuation,%
7 ]%
8 {jlreq}
9 \jlreqsetup{%
10 itemization_beforeafter_space=0pt,%
11 itemization_itemsep=0pt%
12 }
13 \makeatletter
14 \RequirePackage{luatexja}
15 \RequirePackage{luatexja-otf}
16 \RequirePackage{graphicx}
17 \RequirePackage{amsmath}
18 \DeclareRobustCommand{\metaphysicaicon}{\raisebox{-4.0pt}{\includegraphics[width=16pt]{metaphysicaicon.pdf}}}
19 \RequirePackage[normalem]{ulem}
20 \RequirePackage[explicit]{titlesec}
21 \titleformat{\section}[hang]{}{}{0pt}{\uuline{\raisebox{1pt}{\textsf{\thesection\quad #1}}}}[\vspace{0.35\baselineskip}]
22 \renewcommand{\thesection}{\S\,\arabic{section}}
23 \let\originalsection\section
24 \DeclareRobustCommand{\section}{\@ifstar{\@metaphysica@section@star}{\@metaphysica@section@nostar}}
25 \DeclareRobustCommand{\@metaphysica@section@star}[1]{\vspace{0.5\baselineskip}\originalsection{#1}\vspace*{-\baselineskip}}
26 \DeclareRobustCommand{\@metaphysica@section@nostar}[1]{\vspace{0.5\baselineskip}\originalsection{#1}}
27 \RequirePackage[%
28 truedimen,%
29 margin=30truemm,
30 includehead%
31 ]{geometry}
32 \RequirePackage{lastpage}
33 \RequirePackage{fancyhdr}
34 \pagestyle{fancy}
35 \DeclareRobustCommand{\headertitle}[2][\metaphysicaicon]{%
36 \rhead[#2]{#1{}\quad\thepage{}/{}\pageref{LastPage}}%
37 \lhead[\thepage{}/{}\pageref{LastPage}\quad{}#1]{#2}%
38 \cfoot{}%
39 }
40 \RequirePackage{setspace}
41 \setstretch{1.155}
42 \DeclareRobustCommand{\linespace}{\@ifstar{\vspace{\baselineskip}}{\vspace{0.25\baselineskip}}}
43 \DeclareRobustCommand{\linesmash}{\@ifstar{\vspace{-\baselineskip}}{\vspace{-0.25\baselineskip}}}
44 \AtBeginDocument{%
45 \abovedisplayskip =0.125\abovedisplayskip
46 \abovedisplayshortskip=0.125\abovedisplayshortskip
47 \belowdisplayskip =0.125\belowdisplayskip
48 \belowdisplayshortskip=0.125\belowdisplayshortskip}
49 \setlength{\jot}{0pt}%
50 \setlength{\mathindent}{2\zw}%
51 \renewcommand{\floatpagefraction}{0.75}
52 \allowdisplaybreaks[2]
53 \RequirePackage[no-math]{fontspec}
54 \RequirePackage[no-math,deluxe,haranoaji]{luatexja-preset}
55 \RequirePackage{multicolpar}
56 \RequirePackage[style=iso]{datetime2}
57 \RequirePackage[unicode]{hyperref}
58 \RequirePackage{xparse}
59 \RequirePackage{dashbox}
60 \newcounter{psuedosectioncounter}
61 \setcounter{psuedosectioncounter}{1}
62 \newcounter{psuedocontentscounter}
63 \setcounter{psuedocontentscounter}{1}
64 \DeclareRobustCommand{\psuedosection}[3]{%
65 \hypertarget{#1}{\mbox{}}\begin{multicolpar}{2}%
66 \noindent\uuline{{\raisebox{1pt}{\textsf{\S\ \thepsuedosectioncounter\quad #2}}}}
67
68 \noindent\uuline{{\raisebox{1pt}{\textsf{\S\ \thepsuedosectioncounter\quad #3}}}}
69 \end{multicolpar}%
70 \stepcounter{psuedosectioncounter}%
71 \vspace{\baselineskip}%
72 }
73 \DeclareRobustCommand{\psuedocontents}[3]{%
74 \begin{multicolpar}{2}%
75 \noindent{\textsf{\hyperlink{#1}{\S\ \thepsuedocontentscounter\quad #2}}}
76
77 \noindent{\textsf{\hyperlink{#1}{\S\ \thepsuedocontentscounter\quad #3}}}\end{multicolpar}%
78 \stepcounter{psuedocontentscounter}%
79 }
80 \newenvironment{translateing}%
81 {\begin{multicolpar}{2}}
82 {\end{multicolpar}\vspace{\baselineskip}}
83 \DeclareRobustCommand{\maketitletranslating}%
84 {\maketitle\thispagestyle{fancy}
85 \vspace{\baselineskip}\begin{multicolpar}{2}
86 \textsf{English}
87
88 \noindent
89 \textsf{日本語 (Japanese)}
90 \end{multicolpar}\vspace{\baselineskip}}
91 \NewDocumentCommand\macroexplanation{v}{%
92 \noindent\hspace*{\fill}{\texttt{#1}}\hspace*{\fill}\linespace%
93 }
94 \NewDocumentEnvironment{macroexample}{O{0.625} +b}{%
95 \noindent\hspace*{\fill}\dbox{\parbox{#1\textwidth}{%
96 #2%
97 }}\hspace*{\fill}}%
98 {\vspace{\baselineskip}}
99 \NewDocumentEnvironment{macroexample*}{O{0.625} m +b}{%
100 \noindent\hspace*{\fill}\dbox{\parbox{#1\textwidth}{%
101 \vspace{-0.5\baselineskip}\begin{#2}%
102 #3
103 \end{#2}%
104 }}\hspace*{\fill}}
105 {\vspace{\baselineskip}}
106 \let\code\texttt
107 \setlength{\fboxsep}{1em}
108 \setstretch{1.05}
109 \DeclareRobustCommand{\commandtojskip}{\hspace{2.40554pt plus 1.49994pt minus 0.59998pt}}
110 \RequirePackage{listings, jlisting}
111 \lstset{
112 language=[LaTeX]TeX,
113 basicstyle={\ttfamily},
114 identifierstyle={\small},
115 commentstyle={\small\itshape},
116 keywordstyle={\small\bfseries},
117 ndkeywordstyle={\small},
118 stringstyle={\small\ttfamily},
119 frame=single,
120 breaklines=true,
121 columns=[l]{fullflexible},
122 stepnumber=1,
123 xrightmargin=0.1709\textwidth,
124 xleftmargin=0.1709\textwidth,
125 lineskip=-0.5ex
126 }
127 \RequirePackage{bxtexlogo}
128 \RequirePackage{shortvrb}
129 \MakeShortVerb{\|}
130 \RequirePackage{hideanswer}
131 \makeatother
132 \hypersetup{%
133 bookmarksnumbered=true,%
134 colorlinks=true,%
135 linkcolor=blue,%
136 urlcolor=blue,%
137 setpagesize=false,%
138 pdftitle={The hideanswer package},%
139 pdfauthor={Yukoh KUSAKABE},%
140 pdfsubject={The hideanswer package},%
141 pdfkeywords={TeX LaTeX answer exam}}
142 \title{The \code{hideanswer} package:\\[0.25\baselineskip]
143 generate documents with and without answers\\[0.25\baselineskip]
144 by toggling a switch}
145 \author{Yukoh KUSAKABE}
146 \date{\today}
147 \headertitle[Yukoh KUSAKABE\quad\metaphysicaicon]{The \code{hideanswer} package}
148 \begin{document}
149 \maketitletranslating
150
151 \begin{translateing}
152 This package can generate documents with and without answers from a single file by toggling a switch.
153 However, it can only be used to create documents to be printed on paper.
154
155 このパッケージは,スイッチ切り替えによって単一のファイルから答えが書かれている文書と答えが書かれていない文書を生成することができます。ただし,紙に印刷する文書を作成するときにしか使えません。
156 \end{translateing}
157
158 \psuedocontents{Requirements}{System Requirements}{前提条件}
159
160 \psuedocontents{Installation}{Installation}{インストール}
161
162 \psuedocontents{Loading}{Loading}{読み込み}
163
164 \psuedocontents{Usage}{Usage}{使用方法}
165
166 \psuedocontents{moreinfo}{For More Information}{問い合わせ・詳しくは}
167
168 \psuedosection{Requirements}{System Requirements}{前提条件}
169
170 \begin{translateing}
171 \textbullet\ \LaTeXe\ format\\
172 \textbullet\ \code{color} package\\
173 \textbullet\ \code{graphicx} package\\
174 \textbullet\ \code{xparse} package
175
176 \noindent
177 \textbullet\ \LaTeXe フォーマット\\
178 \textbullet\ \code{color} パッケージ\\
179 \textbullet\ \code{graphicx} パッケージ\\
180 \textbullet\ \code{xparse} パッケージ
181 \end{translateing}
182
183 \newpage
184 \psuedosection{Installation}{Installation}{インストール}
185
186 \begin{translateing}
187 If not available, move hideanswer.sty file to\\\code{\$TEXMF/tex/latex/hideanswer}.
188
189 直ちに使えなければ,hideanswer.sty を\\\code{\$TEXMF/tex/latex/hideanswer}\\%(\TeX が見つけられる場所)
190 に置いてください。
191 \end{translateing}
192
193 \psuedosection{Loading}{Loading}{読み込み}
194
195 \begin{translateing}
196 To use this package, load .sty file with |\usepackage{hideanswer}| command in preamble.
197
198 このパッケージを使用するには,プリアンブルに\commandtojskip|\usepackage{hideanswer}| と書いてください。
199
200 No package option is available.
201
202 オプションはありません。
203 \end{translateing}
204
205 \psuedosection{Usage}{Usage}{使用方法}
206
207 \begin{translateing}
208 \textsf{PRECAUTIONS:}\\
209 In this package, hiding text is accomplished by changing the color to white.
210 Therefore, the hidden content will be known to the recipient in the PDF file.
211 This package was developed for printing on paper.
212
213 \noindent\textsf{使用前の注意:}\\
214 このパッケージにおいて,文字を非表示にすることは色を白に変えることによって実現しています。
215 したがって,PDFファイルでは隠した内容が相手に伝わってしまいます。
216 このパッケージは紙に印刷して使うために開発されました。
217 \end{translateing}
218
219 \macroexplanation{\sethideanswer}
220
221 \begin{translateing}
222 After this command, the answer is hidden.
223 Usually, this instruction is used to switch the generation of question and answer sheets, depending on whether or not this instruction is written at the beginning of the document.
224
225 この命令以降では答えが隠されます。ふつう,文書の最初にこの命令を書くか否かで問題用紙と解答用紙の生成を切り替えるために使います。
226 \end{translateing}
227
228 \macroexplanation{\unsethideanswer}
229
230 \begin{translateing}
231 After this command, the answer appears.
232
233 この命令以降では答えが現れます。
234 \end{translateing}
235
236 \newpage
237 \macroexplanation{\hideanswer{<text>}}
238
239 \begin{translateing}
240 |<text>| is hidden. In |\hideanswer*{<text>}|, the hidden and visible parts are reversed.
241
242 |<text>|\commandtojskip と書かれた部分が隠されます。
243 |\hideanswer*{<text>}|\commandtojskip では,隠されるときと現れるときが逆になります。
244 \end{translateing}
245
246 \begin{lstlisting}
247 A\hideanswer{B}A, C\hideanswer*{D}C.
248 \end{lstlisting}
249
250 \hspace*{0.14\textwidth}Under |\unsethideanswer| (or default):\\
251 \unsethideanswer
252 \begin{macroexample}
253 A\hideanswer{B}A, C\hideanswer*{D}C.
254 \end{macroexample}
255
256 \hspace*{0.14\textwidth}Under |\sethideanswer|:\\
257 \sethideanswer
258 \begin{macroexample}
259 A\hideanswer{B}A, C\hideanswer*{D}C.
260 \end{macroexample}
261
262 \newpage
263 \macroexplanation{environment hideanswerdiv}
264
265 \begin{translateing}
266 The written part inside the environment is hidden. It may be used to hide long answers. In |hideanswerdiv*|, the hidden and visible parts are reversed.
267
268 環境の内側に書かれた部分が隠されます。長い答えを隠すために用いるとよいでしょう。
269 |hideanswerdiv*|\commandtojskip では,隠されるときと現れるときが逆になります。
270 \end{translateing}
271
272 \begin{lstlisting}
273 E
274 \begin{hideanswerdiv}
275 \[F\]
276 \end{hideanswerdiv}%
277 E
278
279 G
280 \begin{hideanswerdiv*}
281 \[H\]
282 \end{hideanswerdiv*}%
283 G
284 \end{lstlisting}
285
286 \hspace*{0.14\textwidth}Under |\unsethideanswer| (or default):\\
287 \unsethideanswer
288 \begin{macroexample}
289 E
290 \begin{hideanswerdiv}
291 \[F\]
292 \end{hideanswerdiv}%
293 E
294
295 G
296 \begin{hideanswerdiv*}
297 \[H\]
298 \end{hideanswerdiv*}%
299 G
300 \end{macroexample}
301
302 \hspace*{0.14\textwidth}Under |\sethideanswer|:\\
303 \sethideanswer
304 \begin{macroexample}
305 E
306 \begin{hideanswerdiv}
307 \[F\]
308 \end{hideanswerdiv}%
309 E
310
311 G
312 \begin{hideanswerdiv*}
313 \[H\]
314 \end{hideanswerdiv*}%
315 G
316 \end{macroexample}
317
318 \newpage
319 \macroexplanation{\smashanswer{<text>}}
320
321 \begin{translateing}
322 |<text>| is hidden and the next sentence is placed as if it were not there. In |\smashanswer*{<text>}|, the hidden and visible parts are reversed.
323
324 |<text>|\commandtojskip と書かれた部分が隠され,それがないかのように次の文が置かれます。
325 |\smashanswer*{<text>}|\commandtojskip では,隠されるときと現れるときが逆になります。
326 \end{translateing}
327
328 \begin{lstlisting}
329 I\smashanswer{J}I, K\smashanswer*{L}K.
330 \end{lstlisting}
331
332 \hspace*{0.14\textwidth}Under |\unsethideanswer| (or default):\\
333 \unsethideanswer
334 \begin{macroexample}
335 I\smashanswer{J}I, K\smashanswer*{L}K.
336 \end{macroexample}
337
338 \hspace*{0.14\textwidth}Under |\sethideanswer|:\\
339 \sethideanswer
340 \begin{macroexample}
341 I\smashanswer{J}I, K\smashanswer*{L}K.
342 \end{macroexample}
343
344 \newpage
345 \macroexplanation{environment smashanswerdiv}
346
347 \begin{translateing}
348 The written part inside the environment is hidden and the next sentence is placed as if it were not there.
349 It may be used to hide long answers.
350 In |smashanswerdiv*|, the hidden and visible parts are reversed.
351
352 環境の内側に書かれた部分が隠され,それがないかのように次の文が置かれます。
353 長い答えを隠すために用いるとよいでしょう。
354 |smashanswerdiv*|\commandtojskip では,隠されるときと現れるときが逆になります。
355 \end{translateing}
356
357 \begin{lstlisting}
358 M%
359 \begin{smashanswerdiv}
360 \[N\]
361 \end{smashanswerdiv}%
362 M
363
364 O%
365 \begin{smashanswerdiv*}
366 \[P\]
367 \end{smashanswerdiv*}%
368 O
369 \end{lstlisting}
370
371 \hspace*{0.14\textwidth}Under |\unsethideanswer| (or default):\\
372 \unsethideanswer
373 \begin{macroexample}
374 M%
375 \begin{smashanswerdiv}
376 \[N\]
377 \end{smashanswerdiv}%
378 M
379
380 O%
381 \begin{smashanswerdiv*}
382 \[P\]
383 \end{smashanswerdiv*}%
384 O
385 \end{macroexample}
386
387 \hspace*{0.14\textwidth}Under |\sethideanswer|:\\
388 \sethideanswer
389 \begin{macroexample}
390 M%
391 \begin{smashanswerdiv}
392 \[N\]
393 \end{smashanswerdiv}%
394 M
395
396 O%
397 \begin{smashanswerdiv*}
398 \[P\]
399 \end{smashanswerdiv*}%
400 O
401 \end{macroexample}
402
403 \newpage
404 \macroexplanation{\hidegraphics[<includegraphics option>]{<file>}}
405
406 \begin{translateing}
407 The graphic is hidden.
408 The options are the same as for |\includegraphics| since |\includegraphics| is loaded internally.
409 In |\hidegraphics*|, the hidden and visible parts are reversed.
410
411 読み込んだ画像が隠されます。
412 |\includegraphics|を内部で読み込みますので,オプションは\commandtojskip|\includegraphics|のものと同様です。
413 |\hidegraphics*|\commandtojskip では,隠されるときと現れるときが逆になります。
414 \end{translateing}
415
416 \macroexplanation{\smashraphics[<includegraphics option>]{<file>}}
417
418 \begin{translateing}
419 The graphic is hidden and the next sentence is placed as if it were not there.
420 The options are the same as for |\includegraphics| since |\includegraphics| is loaded internally.
421 In |\hidegraphics*|, the hidden and visible parts are reversed.
422
423 読み込んだ画像が隠され,それがないかのように次の文が置かれます。
424 |\includegraphics|を内部で読み込みますので,オプションは\commandtojskip|\includegraphics|のものと同様です。
425 |\smashraphics*|\commandtojskip では,隠されるときと現れるときが逆になります。
426 \end{translateing}
427
428 \macroexplanation{\switchanswer{<text under unsethide>}{<text under sethide>}}\\
429 \macroexplanation{\switchanswer*{<text under sethide>}{<text under unsethide>}}
430
431 \begin{translateing}
432 Switching between hidden and visible sentences. Since |\switchanswer(*)| does not remember the length of the sentence, the position of the next sentence moves.
433
434 隠されているときと現れているときで文章を切り替えます。
435 |\switchanswer(*)|\commandtojskip は文章の長さを覚えませんから,次の文の位置が動きます。
436 \end{translateing}
437
438 \psuedosection{contact}{Contact}{問い合わせ}
439
440 \noindent\hspace*{\fill}\begin{tabular}{rl}
441 Yukoh KUSAKABE:&\url{https://www.metaphysica.info/}\\
442 &\url{https://x.com/metaphysicainfo}\\
443 &(screen-name, 日下部幽考 in Japanese)
444 \end{tabular}\hspace*{\fill}
445 \end{document}