summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ascmac/ascmac.dtx
blob: 483aee8cf2e0d769eb2b1483e636ac23fb906b02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
% \iffalse meta-comment
%
%  Copyright (c) 2010 ASCII MEDIA WORKS
%  Copyright (c) 2016-2020 Japanese TeX Development Community
%
%  This file is part of ascmac community edition.
%  -------------------------------------------------------------
%
% \fi
%
%
% \iffalse
%
% 2020/01/15 v2.1
%     - Use an external map file for supporting dvips.
% 2020/01/14 v2.0j
%     - Fix a bug introduced in v2.0i for XeLaTeX.
% 2020/01/13 v2.0i
%     - Fix a bug: latex in DVI mode of pdfTeX did not work.
% 2018/03/09 v2.0h
%     - Moved to new GitHub repository:
%       https://github.com/texjporg/ascmac
% 2017/12/22 v2.0g
%     - Made compatible with pict2e also for tate-gumi.
% 2017/12/17 v2.0f
%     - Fix a bug.
% 2017/12/06 v2.0e
%     - Again works with non-e-TeX engines.
% 2017/07/22 v2.0d
%     - Check existing \Return definition and throw an error
%       if it is not compatible with ascmac.
% 2016/08/21 v2.0c
%     - Support pdfLaTeX, XeLaTeX and LuaLaTeX.
% 2016/04/15 v2.0b
%     - Simplify \@keytop.
% 2016/03/13 v2.0a
%     - Avoid arithmetic overflow in \mask/\maskbox.
% 2016/03/12 v2.0
%     - Converted to DTX file.
%     - Remove extra spaces before/after \keytop[c]{...}.
%     - Adjust parameters for \keytop.
% 2016/03/06
%     - Set \tbaselineshift in itembox str and shadebox env.
%     - Delete \tbaselineshift\z@ in \mask and \Maskbox.
%     - Save \ybaselineshift.
% 2016/03/04
%     - boxnote, shadebox begin with \par\vspace{.3\baselineskip}.
%     - Adjust the width of shadebox environment.
% 2016/02/21 (many thanks to ZR for suggestions in bxascmac)
%     - Made compatible with pict2e (tate-gumi not supported yet).
%     - Adjust parameters for drawing rounded rectangles.
%     - Fix bugs in \maskbox and \Maskbox.
% 2006/07/14 (ST): itembox, screen environment bug fix.
% 2002/04/01 (KN): ASCII logo macros
% 1998/11/27 (KN and FTEXers): itembox
% 1998/02/27 (KN): set \tbaselineshift in minipage environment.
%
% \fi
%
% \iffalse
%<*ascmac>
%% wrapper for tascmac.sty
%%
%</ascmac>
%<*tascmac>
%% "tascmac" document style option for tate gumi.
%%
%% Original version:
%%   Copyright (C) by 1993, ASCII Corporation & Impress Corporation.
%%   (Last update: 2006/07/14)
%% Modified by Japanese TeX Development Community, since 2016.
%%
%% (ChangeLog has moved to the source file ``ascmac.dtx'')
%%
%</tascmac>
%<ascmac|tascmac>\NeedsTeXFormat{LaTeX2e}
%<*driver>
\NeedsTeXFormat{pLaTeX2e}
\ProvidesFile{ascmac.dtx}
%</driver>
%<tascmac>\ProvidesPackage{tascmac}
%<ascmac>\ProvidesPackage{ascmac}
  [2020/01/15 v2.1
%<driver|tascmac>  ascmac package (community edition)
%<ascmac>  ascmac wrapper (community edition)
  ]
%<*driver>
\documentclass{jltxdoc}
\usepackage{ascmac}
\GetFileInfo{ascmac.dtx}
\title{The \textsf{ascmac} package \fileversion}
\author{Japanese \TeX\ Development Community}
\date{作成日:\filedate}
\begin{document}
  \maketitle
  \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
% \tableofcontents
%
% \section{はじめに}
%
% \textsf{ascmac}パッケージは、\LaTeXe{}の標準機能の範囲で、図や罫線で
% 囲んだボックスを出力する命令などを提供します。\textsf{ascmac}パッケージ
% の実体は\textsf{tascmac}パッケージですが、これはもともと古いp\LaTeX{}で
% 配布されていた横組専用\textsf{ascmac}パッケージと、それを縦組に対応させ
% た\textsf{tascmac}パッケージを統合した名残です。
%
% このドキュメントは、アスキーによって配布されている 2006/07/14 バージョン
% から派生して、日本語\TeX{}開発コミュニティによって開発されているバージョン
% のために新たに書かれました。コミュニティ版では、オリジナルのアスキー版の
% コードを元に、いくつかのバグ修正と他のパッケージとの互換性を改善しました。
% また、v2.0c以降ではpdf\LaTeX{}などのエンジンもサポートしました。
%
%\iffalse
% The package \textsf{ascmac} provides fancy boxes etc., within the scope
% of native \LaTeXe\ picture commands (thus driver-independent).
% This package was originally part of Japanese \pLaTeX, but now it
% supports pdf\LaTeX, Xe\LaTeX\ and Lua\LaTeX.
%\fi
%
% \section{使いかた}
%
% \subsection{環境型の命令}
%
% \textsf{ascmac}パッケージが提供する環境型の命令は4種類あります。それぞれ
% テキストなどを罫線枠で囲んで出力します。
%
% これらの環境は、すべて横幅がその時点での |\linewidth| の値になりますの
% で、ボックスの幅を変更したい場合は |minipage| 環境などで囲んでください。
% 縦の長さは、自動的に内容に合わせて調整されます。 \medskip
%
% \DescribeEnv{boxnote}
% |boxnote| 環境は、破ったメモ用紙のような雰囲気のボックスを作ります。
% 破ったような形の罫線は、ascgrpフォントを使って実現されています。
%
% \begin{boxnote}
% ボックスノート環境です。
% \end{boxnote}
% は、以下の入力から得られます。
%\begin{verbatim}
% \begin{boxnote}
% ボックスノート環境です。
% \end{boxnote}
%\end{verbatim}
%
% \DescribeEnv{screen}
% |screen| 環境は、四隅が丸い囲み枠の中にテキストを入れます。
% オプション引数として |0| から |8| の整数値を指定すれば、四隅の丸みの
% 具合を変更することができます。整数値を大きくするにつれて丸みは小さく
% なっていきます。省略した場合は |0| とみなされます。
%
% \begin{screen}
% 四隅が丸い囲み枠です。
% \end{screen}
% \begin{screen}[4]
% 四隅が丸い囲み枠です。
% \end{screen}
% は、以下の入力から得られます。
%\begin{verbatim}
% \begin{screen}
% 四隅が丸い囲み枠です。
% \end{screen}
% \begin{screen}[4]
% 四隅が丸い囲み枠です。
% \end{screen}
%\end{verbatim}
%
% \DescribeEnv{itembox}
% |itembox| 環境は |screen| 環境に似ていますが、上端の罫線のところにタイトル
% を出力することができます。また、オプション引数 |l|, |c|, |r| でタイトル
% の出力位置を左、中央、右と指定できます。省略した場合は中央になります。
%
% \begin{itembox}[l]{タイトル}
% 項目ボックスです。
% \end{itembox}
% は、以下の入力から得られます。
%\begin{verbatim}
% \begin{itembox}[l]{タイトル}
% 項目ボックスです。
% \end{itembox}
%\end{verbatim}
%
% \DescribeEnv{shadebox}
% |shadebox| 環境は、影付きボックスの中にテキストを入れます。
% 影の幅は |\shaderule| パラメータで規定され、デフォルトは5ptです。
%
% \begin{shadebox}
% 影付きのボックスです。
% \end{shadebox}
% は、以下の入力から得られます。
%\begin{verbatim}
% \begin{shadebox}
% 影付きのボックスです。
% \end{shadebox}
%\end{verbatim}
%
% \subsection{網掛け命令}
%
% 網掛けをする命令が3種類用意されています。|\mask| 命令は、引数の内容の部分
% に網を掛けます。|\maskbox| 命令と |\Maskbox| 命令は、幅と高さを指定して
% 網掛けすることができます。そして、|\maskbox| 命令と |\Maskbox| 命令の違い
% は、後者のみボックスの周りに罫線を引くという点です。
%
% これらの命令は、いずれもascgrpフォントに収録されている網掛けパターンの
% 文字を並べることで網掛けを実現しています。
%
% \makeatletter
% \begin{table}[htbp]
%   \centering
%   \begin{tabular}{llll}
%     A = {\@ascgrp A} & B = {\@ascgrp B} & C = {\@ascgrp C} & D = {\@ascgrp D} \\
%     E = {\@ascgrp E} & F = {\@ascgrp F} & G = {\@ascgrp G} & H = {\@ascgrp H} \\
%     I = {\@ascgrp I} & J = {\@ascgrp J} & K = {\@ascgrp K} &
%   \end{tabular}
% \end{table}
% \makeatother
%
% \DescribeMacro{\mask}
% |\mask| 命令は、第1引数が網掛けをする内容で、第2引数が網掛けパターンを
% 示す記号(AからK)です。
%
% \begin{center}
% \mask{網掛け例1}{A} \hfil \mask{網掛け例2}{C}
% \end{center}
% は、以下の入力から得られます。
%\begin{verbatim}
% \mask{網掛け例1}{A} \hfil \mask{網掛け例2}{C}
%\end{verbatim}
%
% \DescribeMacro{\maskbox}
% |\maskbox| 命令は5つの引数を持ち、それぞれボックスの幅、高さ、
% 網掛けパターン、出力位置、網掛けをする内容です。出力位置は |l|, |c|, |r| の
% いずれかで、それぞれ左、中央、右に出力します。
%
% \begin{center}
% \maskbox{25em}{4em}{E}{c}{幅を指定した網掛けボックス}
% \end{center}
% は、以下の入力から得られます。
%\begin{verbatim}
% \maskbox{25em}{4em}{E}{c}{幅を指定した網掛けボックス}
%\end{verbatim}
%
% \DescribeMacro{\Maskbox}
% |\Maskbox| 命令は |\maskbox| 命令と同様の引数を持ちますが、網掛けをする内容の
% 指定の前、すなわち5番目の引数として、ボックスを囲む罫線の太さも指定します。
% したがって、全部で6つの引数を持ちます。
%
% \begin{center}
% \Maskbox{30em}{4em}{A}{c}{1pt}{幅を指定した罫線付き網掛けボックス}
% \end{center}
% は、以下の入力から得られます。
%\begin{verbatim}
% \Maskbox{30em}{4em}{A}{c}{1pt}{幅を指定した罫線付き網掛けボックス}
%\end{verbatim}
%
% \subsection{その他の命令}
%
% \DescribeMacro{\keytop}
% |\keytop| コマンドは、キーボード上の文字を示すときなどに便利です。
%
% \begin{table}[htbp]
%   \centering
%   \begin{tabular}{cc}
%     入力          & 出力        \\
%     |\keytop{A}|  & \keytop{A}  \\
%     |\keytop{あ}| & \keytop{あ}
%   \end{tabular}
% \end{table}
%
% \DescribeMacro{\yen}
% \DescribeMacro{\return}
% \DescribeMacro{\Return}
% 円記号を出力する |\yen| 命令は、Yと=を重ね合わせて出力しています。
% 改行記号は |\return| と |\Return| です。改行記号はascgrpフォント
% を用いています。
%
% \begin{table}[htbp]
%   \centering
%   \begin{tabular}{cc}
%     入力          & 出力        \\
%     |\yen|        & \yen        \\
%     |\return|     & \return     \\
%     |\Return|     & \Return
%   \end{tabular}
% \end{table}
%
% \DescribeMacro{\ascii}
% \DescribeMacro{\Ascii}
% \DescribeMacro{\ASCII}
% アスキーコーポレーションのロゴを出力する命令です。
% サイズは3種類用意されています。
%
% \ascii \hfil \Ascii \hfil \ASCII
%
%
% \StopEventually{}
%
% \section{コード}
%
% \textsf{ascmac}パッケージは\textsf{tascmac}パッケージのラッパーです。
%    \begin{macrocode}
%<*ascmac>
\RequirePackage{tascmac}
%</ascmac>
%    \end{macrocode}
%
% 従来、\textsf{tascmac}パッケージの動作条件は、p\LaTeXe{}でした。
% しかし、community editionでは、バージョンv2.0c以降でほかのエンジンも
% サポートすることにしました。
%    \begin{macrocode}
%<*tascmac>
%%
%% Originally `ascmac' and `tascmac' can be used only in
%% pLaTeX, upLaTeX or LuaLaTeX with LuaTeX-ja support.
%% We (texjporg) started to support other engines, such as
%% pdfLaTeX, XeLaTeX and LuaLaTeX (even without LuaTeX-ja).
%%
\newif\ifascmac@ptex \ascmac@ptextrue
\ifx\kanjiskip\@undefined
  \@ifpackageloaded{luatexja}{%
    \PackageInfo{tascmac}{%
      Patch from LuaTeX-ja will be applied}%
  }{%
    \PackageInfo{tascmac}{%
      Assuming pdfLaTeX, XeLaTeX or LuaLaTeX}%
    \ascmac@ptexfalse
  }%
\fi
%    \end{macrocode}
%
% (u)p\LaTeXe{}とLua\TeX-ja以外をサポートするためのトリックです。
% 「Q」という文字のカテゴリーコードをこのパッケージを読んでいる間だけ
% 変更し、(u)p\LaTeXe{}またはLua\TeX-jaでは無視する文字に、それ以外では
% コメント文字(|%|と同じ)にします。
% \changes{2016/08/21}{v2.0c}{pdf\LaTeX{}などをサポート}
%    \begin{macrocode}
\chardef\ascmac@q@catcode=\catcode`\Q\relax
\ifascmac@ptex
  \catcode`\Q=9\relax
\else
  \catcode`\Q=14\relax
\fi
%    \end{macrocode}
%
% 以前の版ではascgrpのType1フォントを設定するために
% pdf\LaTeX{}やLua\LaTeX{}のプリミティブを使用していましたが、
% v2.1ではマップファイル(ascmac.map)を用意しました。
% このmapファイルを\verb+$TEXMF/fonts/map/dvips/ascmac/+にインストールして
%\begin{verbatim}
%   updmap-sys --enable MixedMap=ascmac.map
%\end{verbatim}
% を実行すれば有効になります。
% \changes{2016/08/21}{v2.0c}{pdf\LaTeX{}でascgrpのType1フォントを使用}
% \changes{2017/12/06}{v2.0e}{念のためe-拡張なしのエンジンでのエラーを防止}
% \changes{2017/12/17}{v2.0f}{判定が逆になっていたのを修正}
% \changes{2020/01/13}{v2.0i}{\LaTeX{}のDVIモードをサポート}
% \changes{2020/01/14}{v2.0j}{v2.0iの変更でXeLaTeXでエラーが出たのを修正}
% \changes{2020/01/15}{v2.1}{dvipsもサポートするため、外部マップファイルに分離}
%    \begin{macrocode}
%%
%% Use Type1 font for ascgrp: moved to an external map file
%\ifx\pdfextension\@undefined
%  \ifx\pdfmapline\@undefined\else
%    % pdfTeX, LuaTeX (<=0.81)
%    % [memo] XeTeX does not have \pdfmapline, but xelatex.ini defines it.
%    % Here we ignore it by checking the existence of \pdfoutput,
%    % as [x]dvipdfmx can add the similar effect implicitly.
%    \ifx\pdfoutput\@undefined\else\ifnum\pdfoutput>\z@\relax
%      \pdfmapline{+ascgrp <ascgrp.pfb}
%      \pdfmapline{+ascii10 <ascii10.pfb}
%      \pdfmapline{+ascii36 <ascii36.pfb}
%    \fi\fi
%  \fi
%\else
%  % LuaTeX (>=0.85)
%  \ifnum\outputmode>\z@\relax
%    \pdfextension mapline{+ascgrp <ascgrp.pfb}
%    \pdfextension mapline{+ascii10 <ascii10.pfb}
%    \pdfextension mapline{+ascii36 <ascii36.pfb}
%  \fi
%\fi
%    \end{macrocode}
%
% \begin{macro}{\@savetbaselineshift}
% \begin{macro}{\@saveybaselineshift}
% |\tbaselineshift| と |\ybaselineshift| を一時退避するための準備です。
% \changes{2016/08/21}{v2.0c}{定義済みの場合はあえて定義しないようにした}
%    \begin{macrocode}
%%
%% ascmac.sty 10/28 '88
%% ASCII special macros
Q \ifx\@savetbaselineshift\@undefined \newdimen\@savetbaselineshift \fi
Q \ifx\@saveybaselineshift\@undefined \newdimen\@saveybaselineshift \fi
%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@@ASCII}
% \begin{macro}{\ascii}
% \begin{macro}{\Ascii}
% \begin{macro}{\ASCII}
% アスキーコーポレーションのロゴです。
%    \begin{macrocode}
%% ASCII logo
\def\@@ASCII#1#2#3{\shortstack{#1 ASCII \\[#3]
  \fontsize{#2}{\z@}\usefont{OT1}{cmss}{m}{n}ASCII CORPORATION}}
\def\ascii{\@ifundefined{@ascii}{\font\@ascii=ascii10 scaled \magstep4}{}%
  \@@ASCII\@ascii{5pt}{-6pt}}
\def\Ascii{\@ifundefined{@Ascii}{\font\@Ascii=ascii10 scaled \magstep5}{}%
  \@@ASCII\@Ascii{6pt}{-7pt}}
\def\ASCII{\@ifundefined{@ASCII}{\font\@ASCII=ascii36}{}%
  \@@ASCII\@ASCII{9pt}{-9pt}}
%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% |boxnote| 環境などで使う命令の準備です。
%    \begin{macrocode}
%% boxnote environment
\font\@ascgrp=ascgrp
\newbox\scb@x \newbox\scscb@x
\newdimen\@bw\newbox\@nbox\newbox\@nbody
%    \end{macrocode}
%
% \begin{environment}{boxnote}
% |boxnote| 環境を定義します。
%    \begin{macrocode}
\def\boxnote{\par\vspace{.3\baselineskip}%
Q \@saveybaselineshift\ybaselineshift\ybaselineshift\z@
Q \@savetbaselineshift\tbaselineshift\tbaselineshift\z@
  \setbox\@nbox=\hbox{\@ascgrp\vrule width1.08pt depth35pt b\hss a\hss b}
  \@whiledim \wd\@nbox<\hsize \do{
  \setbox\@nbox=\hbox{\@ascgrp\unhbox\@nbox \hss a\hss b}}
  \setbox\@nbox=\hbox to\hsize{\@ascgrp\unhbox\@nbox \hss a\hss b%
  \vrule width1.08pt depth35pt}
  \@bw=\wd\@nbox\advance\@bw -40pt
  \begin{lrbox}{\@nbody}\begin{minipage}{\@bw}% (KN:1998/02/27)
Q   \ybaselineshift\@saveybaselineshift \tbaselineshift\@savetbaselineshift
}%
%    \end{macrocode}
%
%    \begin{macrocode}
\def\endboxnote{\end{minipage}\end{lrbox}%
  \vbox{\parindent=0pt\offinterlineskip\copy\@nbox
  \hbox to\wd\@nbox{\vrule width1.08pt\hfil\box\@nbody\hfil\vrule width1.08pt}
  \hbox to\wd\@nbox{\vrule width1.08pt height15pt\hfil
  \vrule width1.08pt height15pt}\hrule height1.08pt}}
%%
%    \end{macrocode}
% \end{environment}
%
% |screen| 環境などで使う命令の準備です。
% コミュニティ版では、縦組でpict2eパッケージと共存しても壊れないように、
% |\oval| を常に横組ボックスの中で呼び出すようにしました。
% このときに |\oval| の引数を正しく渡す処理も追加しています。
% \changes{2017/12/22}{v2.0g}{縦組でpict2eと共存しても壊れないように、
%    \cs{oval}を常に横組ボックスの中で呼び出すようにした}
%    \begin{macrocode}
%% screen environment
\newdimen\@scw
\newbox\ascmac@hoboxa
\newbox\ascmac@hoboxb
\def\ascmac@parse@ovarg#1{%
Q \iftdir
Q   \def\ascmac@ovarg{}%
Q   \@tfor\reserved@a:=#1\do{%
Q     \if l\reserved@a \edef\ascmac@ovarg{\ascmac@ovarg t}%
Q     \else\if t\reserved@a \edef\ascmac@ovarg{\ascmac@ovarg r}%
Q     \else\if r\reserved@a \edef\ascmac@ovarg{\ascmac@ovarg b}%
Q     \else\if b\reserved@a \edef\ascmac@ovarg{\ascmac@ovarg l}%
Q     \fi\fi\fi\fi}%
Q \else
    \def\ascmac@ovarg{#1}%
Q \fi
}
\def\ascmac@pass@oval#1#2{\oval(#2,#2)[#1]}
\def\@hobox#1#2#3{%
  \ascmac@parse@ovarg{#1}\setbox\ascmac@hoboxa=\hbox{%
Q   \yoko
    \expandafter\ascmac@pass@oval\expandafter{\ascmac@ovarg}{#3}\hss}%
  \ascmac@parse@ovarg{#2}\setbox\ascmac@hoboxb=\hbox{%
Q   \yoko
    \expandafter\ascmac@pass@oval\expandafter{\ascmac@ovarg}{#3}\hss}%
  \wd\ascmac@hoboxa=\z@ \wd\ascmac@hoboxb=\z@
  % the following two lines are unnecessary for (u)pLaTeX, but
  % added intentionally for LuaTeX-ja (\wd <-> \ltjsetwd incompatible)
  \ht\ascmac@hoboxa=\z@ \ht\ascmac@hoboxb=\z@
  \dp\ascmac@hoboxa=\z@ \dp\ascmac@hoboxb=\z@
  \hbox to\@scw{\box\ascmac@hoboxa\hfil\box\ascmac@hoboxb\relax
  \dimen\z@=#3\unitlength\advance\dimen\z@\@wholewidth
  \vrule\@width\z@\@height\z@\@depth.5\dimen\z@}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@vrf@#1#2{\vskip#1\leaders\vrule width#2\vfil\vskip#1}
%    \end{macrocode}
%
% \begin{environment}{screen}
% |screen| 環境を定義します。
%    \begin{macrocode}
\def\screen{%
Q \@saveybaselineshift\ybaselineshift \ybaselineshift\z@
Q \@savetbaselineshift\tbaselineshift \tbaselineshift\z@
  \@ifnextchar[{\@screen}{\@screen[0]}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@screen[#1]{\ifcase#1\def\@r{20}\def\@s{9.8pt}\def\@sx{10pt}\or
  \def\@r{18}\def\@s{8.8pt}\def\@sx{9pt}\or
  \def\@r{16}\def\@s{7.8pt}\def\@sx{8pt}\or
  \def\@r{14}\def\@s{6.8pt}\def\@sx{7pt}\or
  \def\@r{12}\def\@s{5.8pt}\def\@sx{6pt}\or
  \def\@r{10}\def\@s{4.8pt}\def\@sx{5pt}\or
  \def\@r{8}\def\@s{3.8pt}\def\@sx{4pt}\or
  \def\@r{6}\def\@s{2.8pt}\def\@sx{3pt}\else
  \def\@r{4}\def\@s{1.8pt}\def\@sx{2pt}\fi
  \par\vspace{.3\baselineskip}\@scw\linewidth \advance\@scw -\@r pt
  \setbox\scb@x=\hbox to\@scw\bgroup\begin{minipage}{\@scw}% (KN:1998/02/27)
Q   \ybaselineshift\@saveybaselineshift \tbaselineshift\@savetbaselineshift
}%
%    \end{macrocode}
%
%    \begin{macrocode}
\def\endscreen{\end{minipage}\egroup%
  \setbox\scscb@x=\hbox to\linewidth{\hfil\vbox{\offinterlineskip%
  \thinlines\setlength{\unitlength}{1pt}\hrule\kern\@s%
  \@hobox{tl}{tr}{\@r}\kern-\@sx\box\scb@x\@hobox{bl}{br}{\@r}%
  \kern-.4pt\hrule}\hfil}\dimen0=\ht\scscb@x%
  \dimen2=\@sx\advance\dimen2 .2pt
  \noindent\hbox to\linewidth{\hbox to.2pt{\vbox to\dimen0{\@vrf@{\dimen2}{.4pt}}%
  \hss}\box\scscb@x\hbox to.2pt{\hss\vbox to\dimen0{\@vrf@{\dimen2}{.4pt}}}\hss}}%
%%
%    \end{macrocode}
% \end{environment}
%
% |itembox| 環境などで使う命令の準備です。
%    \begin{macrocode}
%% itembox environment
%%   replace \box0 with \@iboxstr; thanks FTEXers (1998/11/27)
\newdimen\@itemh\newtoks\@iboxpos\newbox\@iboxstr
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@hleader{\leaders\hrule height .8pt\hfil}
%    \end{macrocode}
%
% \begin{environment}{itembox}
% |itembox| 環境を定義します。
%    \begin{macrocode}
\def\itembox{\@ifnextchar[{\@itembox}{\@itembox[c]}}
\def\@itembox[#1]#2{%
Q \@saveybaselineshift\ybaselineshift\ybaselineshift\z@
Q \@savetbaselineshift\tbaselineshift\tbaselineshift\z@
  \par\vspace{.3\baselineskip}%
  \setbox\@iboxstr=\hbox{%
Q \ybaselineshift\@saveybaselineshift \tbaselineshift\@savetbaselineshift
  #2}%
  \@itemh\ht\@iboxstr\advance\@itemh\dp\@iboxstr
  \vspace{.5\@itemh}\bgroup\@scw\linewidth
  \advance\@scw-20pt\@iboxpos={#1}%
  \setbox\scb@x=\hbox to\@scw\bgroup\begin{minipage}{\@scw}%
Q \ybaselineshift\@saveybaselineshift
Q \tbaselineshift\@savetbaselineshift% (KN:1998/02/27)
  \vspace*{.5\@itemh}}%
%    \end{macrocode}
%
%    \begin{macrocode}
\def\enditembox{\end{minipage}\egroup%
  \setbox\scscb@x=\hbox to\linewidth{\hfil\vbox{\offinterlineskip%
  \thicklines\setlength{\unitlength}{1pt}%
  \hbox to\@scw{\if l\the\@iboxpos\else\@hleader\fi
    \space\vbox to.8pt{\vss\hbox{\box\@iboxstr}\vss}%
    \space\if r\the\@iboxpos\else \@hleader\fi}\kern9.6pt
  \@hobox{tl}{tr}{20}\kern-10pt\box\scb@x\@hobox{bl}{br}{20}%
  \kern-.8pt\hrule height.8pt}\hfil}\dimen0=\ht\scscb@x%
  \noindent\hbox to\linewidth{\hbox to.4pt{\vbox to\dimen0{\@vrf@{10.4pt}{.8pt}}%
  \hss}\box\scscb@x\hbox to.4pt{\hss\vbox to\dimen0{\@vrf@{10.4pt}{.8pt}}}%
  \hss}\egroup}
%%
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\keytop}
% \begin{macro}{\@keytop}
% |\keytop| 命令です。
%    \begin{macrocode}
%% \keytop
\def\keytop{\@ifnextchar[{\@keytop}{\@keytop[d]}}
\def\@keytop[#1]#2{%
  {\setbox0=\hbox{\shortstack{#2}}%
Q \ybaselineshift\z@ \tbaselineshift\z@
  \dimen0=\wd0\advance\dimen0 5pt\dimen1=\dp0\advance\dimen1 2.5pt%
  \setbox\scscb@x=\hbox to\dimen0{%
Q \iftdir\tate\else\yoko\fi
  \@scw\wd0\hfil\vtop{\offinterlineskip
  \thinlines\setlength{\unitlength}{1pt}\hrule\kern2.3pt\@hobox{tl}{tr}5%
  \kern-2.4pt\box0\@hobox{bl}{br}5\kern-.4pt\hrule}\hfil}%
  \dimen0=\dp\scscb@x\advance\dimen0 -.4pt
  \setbox0=\vbox{\hbox{\hbox to.2pt{\vtop to\dimen0{\@vrf@{2.3pt}{.4pt}}\hss}%
  \box\scscb@x\hbox to.2pt{\hss\vtop to\dimen0{\@vrf@{2.3pt}{.4pt}}}}}%
  \if #1c\mbox{}$\vcenter{\box0}$\mbox{}\else
  \if #1t\else\if #1b\boxmaxdepth=0pt\else
  \boxmaxdepth=\dimen1\fi\fi \mbox{}\vbox{\box0}\fi}}
%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\yen}
% \changes{1996/03/13}{v1.1}{Append \cs{leavevmode} in
%     \cs{yen}, \cs{return}, \cs{Return} command.}
% 円記号です。
%    \begin{macrocode}
%% \yen
\def\yen{\leavevmode\hbox{%
Q \iftdir\yoko\fi
  \setbox0=\hbox{Y}Y\kern-.97\wd0\vbox{\hrule height.1ex width.98\wd0
  \kern.33ex\hrule height.1ex width.98\wd0\kern.45ex}}}
%    \end{macrocode}
%%
% \end{macro}
%
% \begin{macro}{\return}
% \begin{macro}{\Return}
% 改行記号です。|\return|や|\Return|という名称はありふれているので、
% ascmacパッケージの定義が別のパッケージと衝突する場合があります
% (例:algorithm2eパッケージ)。
% そこで、|\Return|という命令が既に定義されていて、かつascgrpフォントが
% 不使用と判断される場合はエラーを出します。本来ならば|\return|も同様に
% チェックしたいのですが、「okumacroパッケージの後にascmacパッケージを
% 読み込むと、エラーなしにascmacパッケージの定義が勝つ」という従来の挙動
% を維持するため、現時点ではチェックしません。
%    \begin{macrocode}
%% return-key
\begingroup
\def\ascmac@definable{\PackageInfo{ascmac}{Command
  \@backslashchar\reserved@a\space already defined, but
  compatible with\MessageBreak ascmac package, overwriting}}
\def\ascmac@check#1{\ifx#1\@undefined\else\ascmac@parse{#1}\fi}
\def\ascmac@parse#1{\edef\reserved@a{\expandafter\@gobble\string #1}%
  \edef\ascmac@parse@tmp{\meaning#1 \string\@ascgrp}%
  \expandafter\ascmac@parse@i\ascmac@parse@tmp\@nil}
\expandafter\def\expandafter\ascmac@parse@i
  \expandafter#\expandafter1\string\@ascgrp#2\@nil{\ifx\relax#2\relax
  \@notdefinable\else\ascmac@definable\fi}
%\ascmac@check{\return}% conflict with okumacro, no check
\ascmac@check{\Return}
\endgroup
%    \end{macrocode}
%
% 改行記号の定義の本体です。
%    \begin{macrocode}
\def\return{\leavevmode\hbox{%
Q \iftdir\yoko\fi
  \@ascgrp\char"20}}
\def\Return{\leavevmode\hbox{%
Q \iftdir\yoko\fi
  \@ascgrp @}}
%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% |\mask| 命令の準備です。
%    \begin{macrocode}
%% \mask
\newbox\@bwsp \newbox\@@bwsp\newcount\@bcal
%    \end{macrocode}
%
%    \begin{macrocode}
\def\setdim@#1#2{\@bcal=#2\divide#1\@bcal\multiply#1\@bcal\advance#1 1.001#2}
%    \end{macrocode}
%
% \begin{macro}{\mask}
% |\mask| 命令を定義します。
%    \begin{macrocode}
\def\mask#1#2{{\setbox\@bwsp=\hbox{#1}%
  \setbox0=\hbox{%
Q \ybaselineshift\z@\tbaselineshift\z@
  \@ascgrp#2}%
  \dimen0=\wd\@bwsp\dimen1=\ht\@bwsp\advance\dimen1\dp\@bwsp\dimen2=-\dimen1
  \setdim@{\dimen0}{\wd0}\setdim@{\dimen1}{\ht0}%
  \setbox\@@bwsp=\hbox to\dimen0{\leaders
  \vtop to\dimen1{\leaders\box0\vfil}\hfil}%
  \advance\dimen2\dp\@@bwsp\divide\dimen2 2
  \advance\dimen2\dp\@bwsp\boxmaxdepth=\dimen2
  \setbox\@@bwsp=\vbox{\box\@@bwsp}%
  \mbox{}\hbox to\wd\@@bwsp{\hbox to0pt{\box\@@bwsp\hss}\hss\unhbox\@bwsp\hss}}}
%%
%    \end{macrocode}
% \end{macro}
%
% |\maskbox| 命令の準備です。
%    \begin{macrocode}
%% \Maskbox{width}{height}{mask_char}{pos}{rule_wid}{body}
%% \maskbox{width}{height}{mask_char}{pos}{body}
\def\@setdim#1#2{\@bcal=#2\divide#1\@bcal\multiply#1\@bcal\advance#1 .001#2}
%    \end{macrocode}
%
% \begin{macro}{\Maskbox}
% \begin{macro}{\maskbox}
% |\maskbox| 命令と |\Maskbox| 命令を定義します。
%    \begin{macrocode}
\def\Maskbox#1#2#3#4#5#6{{%
  \setbox0=\hbox{%
Q \ybaselineshift\z@\tbaselineshift\z@
  \@ascgrp#3}%
  \dimen0=#1\@setdim{\dimen0}{\wd0}\dimen1=#2\@setdim{\dimen1}{\ht0}%
  \ifx#4c\skip0=0pt plus1fil\skip1=\skip0\fi
  \ifx#4r\skip0=0pt plus1fil\skip1=0pt\fi
  \ifx#4l\skip1=0pt plus1fil\skip0=0pt\fi
  \leavevmode
  \hbox{\hbox to0pt{\hbox to\dimen0{\leaders\vbox to\dimen1{\leaders
  \box0\vfil}\hfil}\hss}%
  \vrule width#5\vbox to\dimen1{\hrule height#5\vfil
  \dimen3=#5\advance\dimen0-2\dimen3\advance\dimen0 .15pt
  \hbox to\dimen0{\hskip\skip0\relax#6\hskip\skip1}%
  \vfil\hrule height#5}\vrule width#5}}}
\def\maskbox#1#2#3#4#5{\Maskbox{#1}{#2}{#3}{#4}{0pt}{#5}}
%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% |shadebox| 環境で使う命令の準備です。
%    \begin{macrocode}
%% shadebox environment
\newdimen\shaderule\shaderule 5pt
%    \end{macrocode}
%
% \begin{environment}{shadebox}
% |shadebox| 環境を定義します。
%    \begin{macrocode}
\def\shadebox{\par\vspace{.3\baselineskip}%
Q \@saveybaselineshift\ybaselineshift\ybaselineshift\z@
Q \@savetbaselineshift\tbaselineshift\tbaselineshift\z@
  \dimen0\linewidth \advance\dimen0-20pt
  \advance\dimen0-2\fboxrule \advance\dimen0-\shaderule
  \setbox\@tempboxa=\hbox\bgroup\minipage{\dimen0}%
Q   \ybaselineshift\@saveybaselineshift \tbaselineshift\@savetbaselineshift
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\endshadebox{\endminipage\egroup\dimen0=10pt
  \setbox\@tempboxa=\hbox{\kern\dimen0\unhbox\@tempboxa\kern\dimen0}%
  \setbox0=\vbox{\hrule \@height \fboxrule
  \hbox{\vrule \@width \fboxrule
  \vbox{\vskip\fboxsep \box\@tempboxa\vskip\fboxsep}%
  \vrule \@width \fboxrule}\hrule \@height \fboxrule}%
  \dimen0=\ht0 \advance\dimen0-\shaderule
  \hbox{\hbox to \shaderule{\copy0\hss}\kern 0pt
  \vrule width\wd0 height0pt depth\shaderule\hskip-\shaderule
  \vrule width\shaderule height\dimen0}}
%%
%    \end{macrocode}
% \end{environment}
%
% トリックに使用した「Q」という文字のカテゴリーコードを元に戻します。
% \changes{2016/08/21}{v2.0c}{pdf\LaTeX{}などをサポート}
%    \begin{macrocode}
\catcode`\Q=\ascmac@q@catcode\relax
%%
%</tascmac>
%    \end{macrocode}
%
% \Finale
%
\endinput