forked from trueroad/FITpaper-class
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFITpaper.cls
More file actions
548 lines (477 loc) · 17.6 KB
/
Copy pathFITpaper.cls
File metadata and controls
548 lines (477 loc) · 17.6 KB
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
% -*- coding: utf-8; mode: latex; -*-
%
% FIT2024 向け LaTeX クラスファイル
% https://github.com/trueroad/FITpaper-class
%
% Copyright (C) 2018, 2019, 2022-2024 Masamichi Hosoda.
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions
% are met:
%
% * Redistributions of source code must retain the above copyright notice,
% this list of conditions and the following disclaimer.
%
% * Redistributions in binary form must reproduce the above copyright notice,
% this list of conditions and the following disclaimer in the documentation
% and/or other materials provided with the distribution.
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
% ARE DISCLAIMED.
% IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
% FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
% OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
% HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
% LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
% OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
% SUCH DAMAGE.
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{FITpaper}[2024/05/08 FIT2024 paper class]
%%
%% エンジン判定
%%
\ifx\luatexversion\@undefined
\ifx\kanjiskip\@undefined
\ClassError{FITpaper}{LuaLaTeX or (u)pLaTeX is required.}{\@ehc}
\else
\let\fitclass@engine=p
\fi
\else
\let\fitclass@engine=l
\fi
%%
%% クラスオプション
%%
\newif\if@fitclass@no@ja@font
\newif\if@fitclass@no@lgc@font
\newif\if@fitclass@no@math@font
\@fitclass@no@ja@fontfalse
\@fitclass@no@lgc@fontfalse
\@fitclass@no@math@fontfalse
\DeclareOption{no_jafont_settings}{\@fitclass@no@ja@fonttrue}
\DeclareOption{no_lgcfont_settings}{\@fitclass@no@lgc@fonttrue}
\DeclareOption{no_mathfont_settings}{\@fitclass@no@math@fonttrue}
\ProcessOptions
%%
%% 前提条件
%%
%
% FIT2024
% Web 記載のページ設定
% https://www.ipsj.or.jp/event/fit/fit2024/paper_require.html
%
% 用紙サイズ
% A4 (210 mm x 297 mm)
% マージン
% 上 30 mm、下 25 mm、左 20 mm、右 20 mm、カラム間 7 mm (いずれも目安)
%
% ※ Web では「カラム間」ではなくて「コラム間」表記
%
%
% FIT2024 サンプルファイル FITpaper.docx 設定より
%
% 本文フォントサイズ
% 9 ポイント = 9 bp
% 本文行送り
% 12 ポイント = 12 bp
%
%%
%% 横方向の計算
%%
% jlreq.cls にはカラム幅(一行の長さ)を指定すれば
% 和文文字幅の整数倍に補正してくれる機能があるが、
% ここでは二段組であり、カラム間も調整したいので自前で計算する。
% カラム幅
% (横 210 mm - 左 20 mm - 右 20 mm - カラム間 7 mm) ÷ 2 = 81.5 mm
% = 231.023622 bp
% カラム一行当たりの和文文字数
% 231.023622 bp ÷ 9 bp = 25 文字 あまり 6.02362205 bp
% 修正後カラム幅(カラム幅を和文文字幅の整数倍に修正する)
% 9 bp × 25 文字 = 225 bp
% 修正すると両カラムそれぞれ幅が 6.02362205 bp 短くなる
% 修正前後で両カラムそれぞれの左右中央を一致させるには、
% カラム間を長くする(増加させる)必要がある。
% カラム間増加分
% 6.02362205 bp = 2.125 mm
% 修正後のカラム間
% カラム間 7 mm + 増加分 2.125 mm = 9.125 mm
% 左右マージンは左右対称になればよいので jlreq.cls に計算してもらう
% (二段組として修正後カラム幅と修正後カラム間のみ指定する)
%%
%% 縦方向の計算
%%
% カラム高さ
% (縦 297 mm - 上 30 mm - 下 25 mm) = 242 mm
% = 685.984252 bp
% カラムの行数
% 685.984252 bp ÷ 行送り 12 bp = 57.1653543 行
%
% ・jlreq.cls 2018/02/01 まで
% 上下双方のマージンを同時に指定することができないが、
% 上マージンだけクラスオプション head_space で指定しておき、
% 裏技的に行数をクラスオプション number_of_lines で実数指定することで、
% 実質的に下マージンの指定をしているのと同等の設定が可能だった。
%
% ・jlreq.cls 2018/04/11
% 上下双方のマージンを同時に指定することはできない。
% (警告が出て下マージンの設定が無視される。)
% 行数指定に実数を指定するとエラーが出るようになった。
% 仕方ないのでクラスのロード後に版面の高さを直接指定する。
% また、クラスをロードする前に jlreq.cls のバージョン判定ができず、
% バージョンによって行数の実数指定可否の分岐ができないので、
% これ以前のバージョンでも、行数実数指定でなく版面高さの直接指定とする。
%
% ・jlreq.cls 2018/05/19 以降
% 天の空き量と地の空き量に異なる値を設定したい
% https://github.com/abenori/jlreq/issues/28
% の議論の結果、上下双方のマージンを同時に指定可能になった。
% クラスオプションとしては、双方を指定しておく。
% 2018/04/11 までであれば、下マージンを無視した旨の警告が出るが、
% 後からバージョン判定して版面高さを直接指定する、以前と同様の処理を行う。
% 対応バージョンと判定した場合は、クラスオプションのみで設定が完了しており、
% 後からすることは何もない。
%
%%
%% 版面設定して jlreq.cls をロード
%%
% 和欧文フォントサイズ比
% LuaLaTeX では 1: 和文を基準として欧文をフォント設定で拡大する
\def\fitclass@jafontscale{1}
\ifx p\fitclass@engine
% (u)pLaTeX では 0.952381 = 1/1.05: 欧文を 5 % 拡大相当にする
\def\fitclass@jafitscale{0.952381}
\fi
\LoadClass[%
twocolumn,% 二段組
paper=a4,% 用紙サイズ A4
jafontsize=9bp,% 本文フォントサイズ 9 ポイント
jafontscale=\fitclass@jafontscale,% 和欧文フォントサイズ比
line_length=25zw,% カラム幅は和文文字幅 25 文字分
head_space=30mm,% 上マージン 30 mm
foot_space=25mm,% 下マージン:jlreq 2018/04/11 まで指定しても無視される
%number_of_lines=57.1653543,% 行数(jlreq 2018/04/11 以降、実数指定できず)
baselineskip=12bp,% 行送り(JLReq コメント出るが FITpaper 設定値)
column_gap=9.125mm,% カラム間
jlreq_notes% JLReq コメントを表示
]{jlreq}
% 版面の高さ
\@ifclasslater{jlreq}{2018/05/19}{%
% jlreq 2018/05/19 から
% クラスオプション head_space, foot_space
% 両方同時指定可能になったのでクラスオプションで完結、何もしない。
\relax}{%
% jlreq 2018/04/11 まで
% 2018/04/11 で行数の実数指定できなくなったため直接版面の高さを設定する。
% 行送りの整数倍に補正しない。
\setlength{\textheight}{242mm}}
% ノンブル無し
\pagestyle{empty}
% 和欧文スケール比を設定
\ifx\Cjascale\@undefined
\edef\Cjascale{\fitclass@jafontscale}
\fi
%%
%% フォント設定
%%
%
% 和文フォント設定
%
\if@fitclass@no@ja@font
\else
\ifx l\fitclass@engine
%
% LuaLaTeX 用和文フォント設定
%
\ifnum\directlua{
if \LuaTeXjaversion >= 20191117.0 then
tex.write("1")
else
tex.write("0")
end
}>0
% luatexja 20191117.0 から
% フォントのプリセット設定に原ノ味フォントを指定可能
% LuaTeX-ja を使う
% (LuaLaTeX を使っていれば jlreq.cls が自動的にロードする)
% haranoaji: 和文フォントは原ノ味フォントを使う
% deluxe: 複数のウェイトを使う
% match: 欧文フォントのファミリ指定と連動させる
% nfss-only: luatexja-fontspec を使わない(メモリ・時間節約)
% jfm_...: JFM は jlreq のものを使う
%
\RequirePackage[haranoaji,deluxe,match,nfssonly,%
jfm_yoko=jlreq,jfm_tate=jlreqv]{luatexja-preset}
\else
% luatexja 20190926.0 まで
% フォントのプリセット設定に原ノ味フォントを指定できない
% LuaTeX-ja を使う
% (LuaLaTeX を使っていれば jlreq.cls が自動的にロードする)
% deluxe: 複数のウェイトを使う
% match: 欧文フォントのファミリ指定と連動させる
% nfss-only: luatexja-fontspec を使わない(メモリ・時間節約)
% jfm_...: JFM は jlreq のものを使う
%
\RequirePackage[deluxe,match,nfssonly,%
jfm_yoko=jlreq,jfm_tate=jlreqv]{luatexja-preset}
% 和文フォントに原ノ味フォントを設定する
\ltjnewpreset{HaranoAji}{%
mc-l = HaranoAjiMincho-Light.otf,
mc-m = HaranoAjiMincho-Regular.otf,
mc-bx = HaranoAjiMincho-Bold.otf,
gt-m = HaranoAjiGothic-Regular.otf,
gt-bx = HaranoAjiGothic-Bold.otf,
gt-eb = HaranoAjiGothic-Heavy.otf,
mg-m = HaranoAjiGothic-Medium.otf}
\ltjapplypreset{HaranoAji}
\fi
\fi
\fi
%
% 数式フォント設定
%
\if@fitclass@no@math@font
\else
\ifx l\fitclass@engine
%
% LuaLaTeX 用数式フォント設定
%
% 数式フォントは STIX 2 を使用
% 和文と同サイズだと小さく見えるため 5% 拡大
%
\RequirePackage[no-math]{fontspec}
\RequirePackage{amsmath}
\RequirePackage{unicode-math}
\unimathsetup{math-style=ISO,bold-style=ISO}
\setmathfont[Scale=1.05]{STIX Two Math}
\fi
\ifx p\fitclass@engine
%
% (u)pLaTeX 用数式フォント設定
%
% newtx を使用
%
\RequirePackage{amsmath}
\RequirePackage{newtxmath}
\fi
\fi
%
% 欧文 (LGC) フォント設定
%
\if@fitclass@no@lgc@font
\else
\ifx l\fitclass@engine
%
% LuaLaTeX 用欧文フォント設定
%
% ここでは和欧文ファミリ連動の考慮はしない。
% 和文フォント設定時に luatexja-preset または luatexja-fontspec に対して
% match オプションを使うなどの必要がある。
%
% セリフフォントは STIX 2 を使用
% サンセリフフォント、等幅フォントは TeX Gyre を使用
% 和文と同サイズだと小さく見えるため 5% 拡大
%
\RequirePackage[no-math]{fontspec}
\setmainfont[Scale=1.05]{STIX Two Text}
\setsansfont[Scale=1.05]{TeX Gyre Heros}
\setmonofont[Scale=1.05]{TeX Gyre Cursor}
\fi
\ifx p\fitclass@engine
%
% (u)pLaTeX 用欧文フォント設定
%
% TeX Gyre を使用
%
\renewcommand{\rmdefault}{qtm}% TeX Gyre Termes
\renewcommand{\sfdefault}{qhv}% TeX Gyre Hereos
\renewcommand{\ttdefault}{qcr}% TeX Gyre Cursor
\fi
\fi
%%
%% 所属
%%
% 著者名の右肩につける所属番号
\newcommand{\affmark}[1]{\footnotemark[#1]}
% 脚注に出す所属名
\def\fitpaper@affiliations{}
\newcommand{\afftext}[2]{%
\expandafter\def\expandafter\fitpaper@affiliations\expandafter{%
\fitpaper@affiliations \footnotetext[#1]{#2}}}
%%
%% タイトル設定
%%
% 段抜きでタイトル、脚注に所属名を出力
% 所属名のフォントサイズは FITpaper.docx 設定値
\renewcommand\maketitle{%
\twocolumn[\@maketitle]%
{\let\footnotesize\normalsize \fitpaper@affiliations}}
%
% 和文タイトル:
% 明朝・セリフ系フォント、サイズ 12 bp (FITpaper.docx 設定値)
% 行送りは本文のサイズ/行送り比と同等に設定
% (FITpaper.docx 設定値は「行間 1 行」だが、これはフォント依存の設定?)
% 段落前のアキ 10 bp (FITpaper.docx 設定値)
% 段落後のアキ 0 行(FITpaper.docx 設定値)
% 欧文タイトル:
% ゴシック・サンセリフ系フォント、サイズ 12 bp (FITpaper.docx 設定値)
% 行送りは本文のサイズ/行送り比と同等に設定
% (FITpaper.docx 設定値は「行間 1 行」だが、これはフォント依存の設定?)
% 段落前後のアキ 0 行(FITpaper.docx 設定値)
% 著者(和文):
% ゴシック・サンセリフ系フォント、サイズ 10.5 bp (FITpaper.docx 設定値)
% 行送りは本文のサイズ/行送り比と同等に設定
% (FITpaper.docx 設定値は「行間 1 行」だが、これはフォント依存の設定?)
% 段落前のアキ 5 bp (FITpaper.docx 設定値)
% 段落後のアキ 0 行(FITpaper.docx 設定値)
% 著者(英文):
% ゴシック・サンセリフ系フォント、サイズ 10.5 bp (FITpaper.docx 設定値)
% 行送りは本文のサイズ/行送り比と同等に設定
% (FITpaper.docx 設定値は「行間 1 行」だが、これはフォント依存の設定?)
% 段落前後のアキ 0 行(FITpaper.docx 設定値)
% タイトル後のアキ 9 bp はタイトル部と本文部のアキを
% 目視で確認して適当に設定したもの
%
\def\@maketitle{%
\centering
\vspace{10bp}
{\jafontsize{12bp}{16bp}\selectfont {\fitpaper@jtitle}} \par
{\jafontsize{12bp}{16bp}\selectfont \sffamily {\fitpaper@etitle}} \par
\vspace{5bp}
{\jafontsize{10.5bp}{14bp}\selectfont \sffamily
\edef\@tempa{\noexpand\begin{tabular}{\fitpaper@authors}}\@tempa
\fitpaper@jauthors \\
\fitpaper@eauthors
\end{tabular}
\ifx \fitpaper@authorstwo \@undefined
\else
\vspace{5bp}
\edef\@tempa{\noexpand\begin{tabular}{\fitpaper@authorstwo}}\@tempa
\fitpaper@jauthorstwo \\
\fitpaper@eauthorstwo
\end{tabular}
\fi
} \par
\vspace{9bp}
}
% タイトル設定
\newcommand{\jtitle}[1]{\def\fitpaper@jtitle{#1}}% 和文
\newcommand{\etitle}[1]{\def\fitpaper@etitle{#1}}% 欧文
% 著者 1 段目設定
\newcommand{\authors}[1]{\def\fitpaper@authors{#1}}% 著者数
\newcommand{\jauthors}[1]{\def\fitpaper@jauthors{#1}}% 和文
\newcommand{\eauthors}[1]{\def\fitpaper@eauthors{#1}}% 欧文
% 著者 2 段目設定
\newcommand{\authorstwo}[1]{\def\fitpaper@authorstwo{#1}}% 著者数
\newcommand{\jauthorstwo}[1]{\def\fitpaper@jauthorstwo{#1}}% 和文
\newcommand{\eauthorstwo}[1]{\def\fitpaper@eauthorstwo{#1}}% 欧文
%%
%% 見出し
%%
%
% \section, \subsection, \subsubsection
%
% フォントサイズ、行送り、前後のアキ(いずれも FITpaper.docx の設定値)
% ゴシック太字からゴシックへ変更
%
\ModifyHeading{section}{font={\jafontsize{10.5bp}{12bp}\selectfont\sffamily},%
lines=1, before_lines=0, after_lines=0,%
before_space=8bp, after_space=6bp}
\ModifyHeading{subsection}{font={\jafontsize{10bp}{12bp}\selectfont\sffamily},%
lines=1, before_lines=0, after_lines=0,%
before_space=6bp, after_space=6bp}
\ModifyHeading{subsubsection}{font={\normalsize\sffamily},%
lines=1, before_lines=0, after_lines=0,%
before_space=0pt, after_space=0pt}
%
% \paragraph, \subparagprah
%
% 特に FITpaper.docx には設定されていないが使えるようにしておく
% ゴシック太字からゴシックへ変更
%
\ModifyHeading{paragraph}{font={\normalsize\sffamily}}
\ModifyHeading{subparagraph}{font={\normalsize\sffamily}}
%
% caption 関係
%
% フォントサイズ、行送り(いずれも FITpaper.docx の設定値)
% フォントをゴシック太字からゴシックへ変更
%
\jlreqsetup{caption_font={\normalsize\selectfont\sffamily},%
caption_label_font={\normalsize\selectfont\sffamily}}
%
% 謝辞と参考文献
%
% フォントサイズ、行送り、前後のアキ(いずれも FITpaper.docx の設定値)
% フォントをゴシック太字からゴシックへ変更
% 節番号のような数字をつけない、センタリング
%
% jlreq 2017/06/11 でセンタリングが変更になっている
\@ifclasslater{jlreq}{2017/06/11}{%
% jlreq 2017/06/11 から
\NewBlockHeading{ackbibsection}{1}{font={\normalsize\selectfont\sffamily},%
lines=1, before_lines=0, after_lines=0,%
before_space=6bp, after_space=2pt, label_format={},%
align=center}}{%
% jlreq 2017/04/29 まで
\NewBlockHeading{ackbibsection}{1}{font={\normalsize\selectfont\sffamily},%
lines=1, before_lines=0, after_lines=0,%
before_space=6bp, after_space=2pt, label_format={},%
indent=center}}
\newcommand{\toclevel@ackbibsection}{1}
%%
%% 参考文献
%%
%
% 参考文献の行長を字幅の整数倍にする
% https://gist.github.com/trueroad/80630e95df5af0234e36270b019e6458
% を改変
% ・フォントサイズ(FITpaper.docx の設定値)
% ・行送りは本文のサイズ/行送り比と同等に設定
% (FITpaper.docx 設定値は「行間 1 行」だが、これはフォント依存の設定?)
% ・見出しを参考文献用に変更
%
\renewenvironment{thebibliography}[1]{%
\jlreq@oldfontcommand@enable
\jafontsize{8bp}{10.666667bp}\selectfont% 追加:フォントサイズ・行送り変更
\ackbibsection{\refname}% 変更:section* -> ackbibsection
\@mkboth{\refname}{\refname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\@tempdima\linewidth
\advance\@tempdima-\labelwidth
\advance\@tempdima-\labelsep
\@tempdimb\@tempdima
\@tempdimc 1\zw
\divide\@tempdima\@tempdimc
\multiply\@tempdima\@tempdimc
\advance\@tempdimb-\@tempdima
\advance\labelsep\@tempdimb
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\itemindent=0pt
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty\clubpenalty
\widowpenalty4000%
\sfcode`\.\@m
}{%
\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist
\jlreq@oldfontcommand@disable
}
%%
%% 謝辞
%%
\newcommand{\acknowledgment}[1]{%
\ackbibsection{謝辞}
#1}