誰でもできる鉄緑っぽいプリント作成
はじめに
この記事は非公式です。 鉄緑会関係者ではないー個人がOSSのみである程度模倣するための方法を解説する意図の記事であることにご留意ください。
必要なもの
最新環境のTeX LiveおよびLuaLaTeXをコンパイルできる環境が必須となります。依存パッケージがかなり新しいものを含むため、必ずversionをご確認ください。
作ってみよう
3秒クッキングです。test.texのようにファイルを作成し、以下をコピペしてください。
そして、ターミナルでlualatex test.texを2回以上実行します(.latexmkrcなどで必要回数を自動でコンパイルしてくれる設定にしてある場合にはその必要はありません)。
\documentclass[paper=b5, fontsize=8pt, fleqn, twoside]{jlreq}
\usepackage{
luatexja,
luwa-ul,
KKsymbols,
keisennote,
multicol,
amsmath, amssymb,
fancyhdr, enumitem,
}
\usepackage[tikz]{multicolrule}
\SetMCRule{line-style=dense-solid-circles, width=0.8pt}
\usepackage[most]{tcolorbox}
\usepackage{calc, varwidth}
\makeatletter
\def\ascb@textgt#1{\textgt{#1}}
\def\ascb@gtfamily{\gtfamily}
\def\ascb@zw#1#2{#1\zw}
\newdimen\ascb@parindent@dimen
\ascb@parindent@dimen=\zw
\DeclareTColorBox{simple}{ o m O{.5} O{} }%
{empty, left=2mm, right=2mm, top=-1mm,
attach boxed title to top left={xshift=\ascb@zw{1.2}{11pt}},
boxed title style={empty,left=-.5mm,right=-.5mm},
colframe=black, coltitle=black, coltext=black, breakable,
before upper={\ascb@parindent{\ascb@parindent@dimen}},%%%
underlay unbroken={\draw[black,line width=#3pt](title.east) -- (title.east-|frame.east) -- (frame.south east) -- (frame.south west) -- (title.west-|frame.west) -- (title.west); },
underlay first={\draw[black,line width=#3pt](title.east) -- (title.east-|frame.east) -- (frame.south east) ;
\draw[black,line width=#3pt] (frame.south west) -- (title.west-|frame.west) -- (title.west); },
underlay middle={\draw[black,line width=#3pt](frame.north east) -- (frame.south east) ;
\draw[black,line width=#3pt](frame.south west) -- (frame.north west) ;},
underlay last={\draw[black,line width=#3pt](frame.north east) -- (frame.south east) -- (frame.south west) -- (frame.north west) ;},
fonttitle=\ascb@gtfamily, IfValueTF={#1}{title=【#2】〈#1〉}{title=【#2】}, #4}
\newcommand{\ascb@parindent}[1]{%
\setlength{\parindent}{#1}\relax%
}
\newlength{\len@ptbs@kk@D}\newlength{\lenn@ptbs@kk@D}\newlength{\myfontsize@ptbs@kk@D}
\newcommand{\titlelength@ptbs@kk@D}[1]{%
\setlength{\myfontsize@ptbs@kk@D}{\f@size pt}
\def\titletext@ptbs@D{\gtfamily\normalsize\selectfont#1}% タイトルフォントに合わせる。
\settowidth{\lenn@ptbs@kk@D}{\titletext@ptbs@D}%
\setlength{\len@ptbs@kk@D}{\linewidth}%
\addtolength{\len@ptbs@kk@D}{-\lenn@ptbs@kk@D}%
\addtolength{\len@ptbs@kk@D}{-.3em}%
\addtolength{\len@ptbs@kk@D}{-1pt}%
\addtolength{\len@ptbs@kk@D}{4mm}%
}
\DeclareTColorBox{ptbs}{ m O{\phantom{A}} O{} }
{enhanced, breakable, boxsep=0mm, lefttitle=1.5mm,
arc=.5mm, bottom=2mm, top=2mm, leftupper=4mm, rightupper=4mm,
colbacktitle=black!100!white, colframe=black!100!white,
coltitle=white, colback=black!10!white, boxrule=1pt,
lefttitle=.3em,
before upper={\ascb@parindent{\ascb@parindent@dimen}},%%%
fonttitle=\gtfamily\normalsize,
fontupper=\gtfamily\normalsize,
title={\titlelength@ptbs@kk@D{#1}#1\kern.3\zw\kern1pt},
after title={%
\tcbox[on line, boxsep=.25\myfontsize@ptbs@kk@D, boxrule=0pt,
top=.1\myfontsize@ptbs@kk@D, bottom=.1\myfontsize@ptbs@kk@D,
left= .5mm,
right=.5mm,
width=\len@ptbs@kk@D,
colback=black!30!white, arc=.5mm]
{\raisebox{.2ex}{\parbox{\len@ptbs@kk@D-.5\myfontsize@ptbs@kk@D-1mm}{\renewcommand{\baselinestretch}{.5}\selectfont#2}}}%
}%
, #3}
\DeclareTColorBox{ascolorbox4A}{ o m O{3} O{}}%
{enhanced, colback=white, colframe=white,
attach boxed title to top left={xshift=1cm,yshift=-\tcboxedtitleheight/2},
varwidth boxed title=0.85\linewidth, coltitle=black,
fonttitle=\ascb@gtfamily,
before skip=.5mm, after skip=.8mm,
before upper={\ascb@parindent{\ascb@parindent@dimen}},%%%
enlarge top by=2mm, enlarge bottom by=2mm, breakable, sharp corners,
boxed title style={colback=white,left=-.6em,right=-.6em},
borderline={.75pt}{#3pt}{black,dotted},
underlay unbroken={\draw[black,line width=.5pt]
(title.east|-frame.north east)--([xshift=-#3*4pt]frame.north east)
arc [start angle=180, end angle=270, radius=#3*4pt]
-- ([yshift=#3*4pt]frame.south east)
arc [start angle=90, end angle=180, radius=#3*4pt]
-- ([xshift=#3*4pt]frame.south west)
arc [start angle=0, end angle=90, radius=#3*4pt]
-- ([yshift=-#3*4pt]frame.north west)
arc [start angle=270, end angle=360, radius=#3*4pt]
-- (frame.north west-|title.west) ;
\filldraw[fill=gray,draw=gray]
(frame.north east) -- +(0pt,-#3*2pt) -- +(-#3*2pt,-#3*2pt) -- +(-#3*2pt,0pt) -- cycle;
\filldraw[fill=gray,draw=gray]
(frame.south east) -- +(-#3*2pt,0pt) -- +(-#3*2pt,#3*2pt) -- +(0pt,#3*2pt) -- cycle;
\filldraw[fill=gray,draw=gray]
(frame.south west) -- +(0pt,#3*2pt) -- +(#3*2pt,#3*2pt) -- +(#3*2pt,0pt) -- cycle;
\filldraw[fill=gray,draw=gray]
(frame.north west) -- +(0pt,-#3*2pt) -- +(#3*2pt,-#3*2pt) -- +(#3*2pt,0pt) -- cycle;
},
underlay first={\draw[black,line width=.5pt]
(title.east|-frame.north east)--([xshift=-#3*4pt]frame.north east)
arc [start angle=180, end angle=270, radius=#3*4pt]
-- (frame.south east) ;
\draw[black,line width=.5pt]
(frame.south west)
-- ([yshift=-#3*4pt]frame.north west)
arc [start angle=270, end angle=360, radius=#3*4pt]
-- (frame.north west-|title.west) ;
\filldraw[fill=gray,draw=gray]
(frame.north east) -- +(0pt,-#3*2pt) -- +(-#3*2pt,-#3*2pt) -- +(-#3*2pt,0pt) -- cycle;
\filldraw[fill=gray,draw=gray]
(frame.north west) -- +(0pt,-#3*2pt) -- +(#3*2pt,-#3*2pt) -- +(#3*2pt,0pt) -- cycle;
},
underlay middle={\draw[black,line width=.5pt]
(frame.north east)--(frame.south east) ;
\draw[black,line width=.5pt]
(frame.south west)--(frame.north west) ;
},
underlay last={\draw[black,line width=.5pt]
(frame.north east) -- ([yshift=#3*4pt]frame.south east)
arc [start angle=90, end angle=180, radius=#3*4pt]
-- ([xshift=#3*4pt]frame.south west)
arc [start angle=0, end angle=90, radius=#3*4pt]
-- (frame.north west);
\filldraw[fill=gray,draw=gray]
(frame.south east) -- +(-#3*2pt,0pt) -- +(-#3*2pt,#3*2pt) -- +(0pt,#3*2pt) -- cycle;
\filldraw[fill=gray,draw=gray]
(frame.south west) -- +(0pt,#3*2pt) -- +(#3*2pt,#3*2pt) -- +(#3*2pt,0pt) -- cycle;
},
IfValueTF={#1}{title=【#2】〈#1〉}{title=【#2】},#4}
\DeclareTColorBox{ascolorbox4A}{ o m O{3} O{}}%
{enhanced, colback=white, colframe=white,
attach boxed title to top left={xshift=1cm,yshift=-\tcboxedtitleheight/2},
varwidth boxed title=0.85\linewidth, coltitle=black,
fonttitle=\ascb@gtfamily,
before skip=.5mm, after skip=.8mm,
before upper={\ascb@parindent{\ascb@parindent@dimen}},%%%
enlarge top by=2mm, enlarge bottom by=2mm, breakable, sharp corners,
boxed title style={colback=white,left=-.6em,right=-.6em},
borderline={.75pt}{#3pt}{black,dotted},
underlay unbroken={\draw[black,line width=.5pt]
(title.east|-frame.north east)--([xshift=-#3*4pt]frame.north east)
arc [start angle=180, end angle=270, radius=#3*4pt]
-- ([yshift=#3*4pt]frame.south east)
arc [start angle=90, end angle=180, radius=#3*4pt]
-- ([xshift=#3*4pt]frame.south west)
arc [start angle=0, end angle=90, radius=#3*4pt]
-- ([yshift=-#3*4pt]frame.north west)
arc [start angle=270, end angle=360, radius=#3*4pt]
-- (frame.north west-|title.west) ;
% 右上 (north east)
\filldraw[fill=gray,draw=gray]
(frame.north east) -- ++(0,-#3*3pt)
arc [start angle=270, end angle=180, radius=#3*3pt]
-- cycle ;
% 左上 (north west)
\filldraw[fill=gray,draw=gray]
(frame.north west) -- ++(#3*3pt,0)
arc [start angle=0, end angle=-90, radius=#3*3pt]
-- cycle ;
% 左下 (south west)
\filldraw[fill=gray,draw=gray]
(frame.south west) -- ++(0,#3*3pt)
arc [start angle=90, end angle=0, radius=#3*3pt]
-- cycle ;
% 右下 (south east)
\filldraw[fill=gray,draw=gray]
(frame.south east) -- ++(-#3*3pt,0)
arc [start angle=180, end angle=90, radius=#3*3pt]
-- cycle ;
},
underlay first={\draw[black,line width=.5pt]
(title.east|-frame.north east)--([xshift=-#3*4pt]frame.north east)
arc [start angle=180, end angle=270, radius=#3*4pt] -- (frame.south east) ;
\draw[black,line width=.5pt]
(frame.south west)
-- ([yshift=-#3*4pt]frame.north west)
arc [start angle=270, end angle=360, radius=#3*4pt]
-- (frame.north west-|title.west) ;
% 右上 (north east)
\filldraw[fill=gray,draw=gray]
(frame.north east) -- ++(0,-#3*3pt)
arc [start angle=270, end angle=180, radius=#3*3pt]
-- cycle ;
% 左上 (north west)
\filldraw[fill=gray,draw=gray]
(frame.north west) -- ++(#3*3pt,0)
arc [start angle=0, end angle=-90, radius=#3*3pt]
-- cycle ;
},
underlay middle={\draw[black,line width=.5pt]
(frame.north east)--(frame.south east) ;
\draw[black,line width=.5pt]
(frame.south west)--(frame.north west) ;
},
underlay last={\draw[black,line width=.5pt]
(frame.north east) -- ([yshift=#3*4pt]frame.south east)
arc [start angle=90, end angle=180, radius=#3*4pt]
-- ([xshift=#3*4pt]frame.south west)
arc [start angle=0, end angle=90, radius=#3*4pt]
-- (frame.north west) ;
% 左下 (south west)
\filldraw[fill=gray,draw=gray]
(frame.south west) -- ++(0,#3*3pt)
arc [start angle=90, end angle=0, radius=#3*3pt]
-- cycle ;
% 右下 (south east)
\filldraw[fill=gray,draw=gray]
(frame.south east) -- ++(-#3*3pt,0)
arc [start angle=180, end angle=90, radius=#3*3pt]
-- cycle ;
},
IfValueTF={#1}{title=【#2】〈#1〉}{title=【#2】},#4}
\tcbset{ascbox@ascolorbox/.style={after skip=1.5mm, before skip=3mm},
ascboxsizeset@ascolorbox/.style={top=0mm,bottom=0mm,right=-1mm,left=2mm,},
titleunderline@ascolorbox/.style={underlay pre={\draw[very thick,draw=gray] ([yshift=.7mm,xshift=3mm]frame.south west) -- ([yshift=.7mm]frame.south east);}}}
\tcbset{rectangle@ascboxA/.style={underlay={\fill[gray] ([xshift=.5mm,yshift=.5mm]frame.#1) -- ++ (-1mm,0mm) -- ++ (0mm,-1mm) -- ++ (1mm,0mm) -- cycle;}},
rectangle@ascboxA/.default={north east},
horizontalline@ascboxA/.style={underlay={\draw ([xshift=1mm]frame.#1 west) -- ([xshift=-1mm]frame.#1 east);}},
horizontalline@ascboxA/.default={north}}
\DeclareTCBox{\ascboxZ}{O{dart} s O{.6} s }%
{empty,ascbox@ascolorbox,ascboxsizeset@ascolorbox,
IfBooleanTF={#4}%
{}{titleunderline@ascolorbox},
IfBooleanTF={#2}%
{underlay={\node[#1,thick,draw=black!40!white,fill=black!70!white,draw,inner sep=#3mm] at (frame.west) {};}}%
{underlay={\node[#1,thick,draw=black!70!white,fill=black!40!white,draw,inner sep=#3mm] at (frame.west) {};}}%
}
\newcommand{\Rhead@TETSUMANE}[1]{\begin{tikzpicture}[remember picture, overlay]
\draw[line width=.5pt] ([yshift=-\top@geom@TETSUMANE+3mm, xshift=-\left@geom@TETSUMANE] current page.north east) -- ([yshift=-\top@geom@TETSUMANE+3mm, xshift=\right@geom@TETSUMANE] current page.north west);
\node[anchor=east,yshift=-\top@geom@TETSUMANE+6mm, xshift=-\left@geom@TETSUMANE] at (current page.north east) {\footnotesize #1};
\draw[line width=.5pt] ([yshift=\bottom@geom@TETSUMANE-3mm, xshift=-\left@geom@TETSUMANE] current page.south east) -- ([yshift=\bottom@geom@TETSUMANE-3mm, xshift=\right@geom@TETSUMANE] current page.south west);
\node[anchor=center] at ([yshift=\bottom@geom@TETSUMANE-6mm, xshift=0.5*(-\left@geom@TETSUMANE+\right@geom@TETSUMANE)]current page.south) {\footnotesize\gtfamily\symbol{"2015}\hspace*{1ex}\thepage\hspace*{1ex}\symbol{"2015}};
\end{tikzpicture}}
\newcommand{\Lhead@TETSUMANE}[1]{\begin{tikzpicture}[remember picture, overlay]
\draw[line width=.5pt] ([yshift=-\top@geom@TETSUMANE+3mm, xshift=\left@geom@TETSUMANE] current page.north west) -- ([yshift=-\top@geom@TETSUMANE+3mm, xshift=-\right@geom@TETSUMANE] current page.north east);
\node[anchor=west,yshift=-\top@geom@TETSUMANE+6mm, xshift=\left@geom@TETSUMANE] at (current page.north west){\footnotesize #1};
\draw[line width=.5pt] ([yshift=\bottom@geom@TETSUMANE-3mm, xshift=-\right@geom@TETSUMANE] current page.south east) -- ([yshift=\bottom@geom@TETSUMANE-3mm, xshift=\left@geom@TETSUMANE] current page.south west);
\node[anchor=center] at ([yshift=\bottom@geom@TETSUMANE-6mm,xshift=0.5*(\left@geom@TETSUMANE-\right@geom@TETSUMANE)]current page.south) {\footnotesize\gtfamily\symbol{"2015}\hspace*{1ex}\thepage\hspace*{1ex}\symbol{"2015}};
\end{tikzpicture}}
\newdimen\top@geom@TETSUMANE
\newdimen\bottom@geom@TETSUMANE
\newdimen\left@geom@TETSUMANE
\newdimen\right@geom@TETSUMANE
\top@geom@TETSUMANE=20mm
\bottom@geom@TETSUMANE=20mm
\left@geom@TETSUMANE=16mm
\right@geom@TETSUMANE=16mm
\usepackage[top=\top@geom@TETSUMANE,bottom=\bottom@geom@TETSUMANE,left=\left@geom@TETSUMANE,right=\right@geom@TETSUMANE]{geometry}
\pagestyle{fancy}
\renewcommand{\headrule}{}
\fancyhead{}
\fancyhead[ER]{\Rhead@TETSUMANE{\gtfamily 柱のタイトル右}}
\fancyhead[OL]{\Lhead@TETSUMANE{\gtfamily 柱のタイトル左}}
\fancyfoot{}
\makeatother
\begin{document}
\begin{ascolorbox4A}[出典:大学名]{例題$n$}
問題文
\end{ascolorbox4A}
\begin{multicols*}{2}
\ascboxZ{ミニタイトル}
あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$
\[x+y=\namiKKAuto{\frac{a+b+c}{e+f}} \hspace{\zw}\textgt{……\kakko{答}}\]
\notefill
\columnbreak
\ascboxZ{ミニタイトル}
\begin{ptbs}{KEY}[タイトル]
ポイント
\end{ptbs}
あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$
\begin{simple}[出典:大学名]{参考問題}
問題文
\end{simple}
あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$
あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああ
あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$
あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああああああああああ$y$あああああああああああああ$x$あああああ
\notefill
\columnbreak
\notefill
\end{multicols*}
\end{document}
これで完成です。出力は冒頭のサンプル画像です。
