hohei’s diary

備忘録?

モンスターボール フレームの紹介

はじめに

tcolorboxパッケージを用いて作成したモンスターボールフレームを紹介します。

とはいえ,ボール部分のコードは大昔に拾ったものを少しイジったものです。 現在はどうやら消されているようで,探しても見つかりませんでした。 問題があればすみません。許してください・・・。

フレームたち

自分が色付きで使わないので,すべて白黒にしています。

\begin{mball}
mball\\
mball\\
mball\\
mball
\end{mball}

\begin{sball}
sball\\
sball\\
sball\\
sball
\end{sball}

\begin{hball}
hball\\
hball\\
hball\\
hball
\end{hball}

\begin{Mball}
Mball\\
Mball\\
Mball\\
Mball
\end{Mball}

プリアンブルでの記述

長いので,別ファイルにして管理するのがいいと思います。

\newtcolorbox{mball}{%
  enhanced,colback=white,colframe=black,boxrule=0.6mm,enlarge top by=3.5mm,enlarge bottom by=2.0mm,overlay={%
\foreach \n in {north east,north west,south east,south west}{%
  \begin{scope}[scale=1.0,rotate=0,shift=(frame.\n)]
    \filldraw[gray,draw=black](1:7.8pt)arc(1:179:7.8pt)--cycle;
    \filldraw[white,draw=white](-1:7.8pt)arc(-1:-179:7.8pt)--cycle;
    \draw[line width=0.6pt,black](0,0)circle[radius=8pt];
    \draw[line width=0.6pt,black](180:8pt)--(0:8pt);
    \filldraw[line width=0.6pt,white,draw=black](0,0)circle[radius=3pt];
    \filldraw[line width=0.1pt,black,draw=black](0,0)circle[radius=1.0pt];
  \end{scope}}
}}

\newtcolorbox{sball}{%
  enhanced,colback=white,colframe=black,boxrule=0.6mm,enlarge top by=3.5mm,enlarge bottom by=2.0mm,overlay={%
\foreach \n in {north east,north west,south east,south west}{
  \begin{scope}[scale=1.0,rotate=0,shift=(frame.\n)]
    \filldraw[gray!40,draw=white](1:7.8pt)arc(1:179:7.8pt)--cycle;;
    \filldraw[white,draw=white](-1:7.8pt)arc(-1:-179:7.8pt)--cycle;
    \filldraw[black](35:4.5pt)--(55:4.5pt)--(55:7.9pt)arc(55:35:7.9pt)--cycle;
    \filldraw[black](145:4.5pt)--(125:4.5pt)--(125:7.9pt)arc(125:145:7.9pt)--cycle;
    \draw[line width=0.6pt,black](0,0)circle[radius=8pt];
    \draw[line width=0.6pt,black](180:8pt)--(0:8pt);
    \filldraw[line width=0.6pt,white,draw=black](0,0)circle[radius=3pt];
    \filldraw[line width=0.1pt,black,draw=black](0,0)circle[radius=1.0pt];
  \end{scope}}
}}

\newtcolorbox{hball}{%
  enhanced,colback=white,colframe=black,boxrule=0.6mm,enlarge top by=3.5mm,enlarge bottom by=2.0mm,overlay={
\foreach \n in {north east,north west,south east,south west}{
  \begin{scope}[scale=1.0,rotate=0,shift=(frame.\n)]
    \filldraw[black](1:7.8pt)arc(1:179:7.8pt)--cycle;;
    \filldraw[white,draw=white](-1:7.8pt)arc(-1:-179:7.8pt)--cycle;
    \filldraw[white](-6.0pt,0.6pt)rectangle(-4.4pt,5.2pt);
    \filldraw[white](6.0pt,0.6pt)rectangle(4.4pt,5.2pt);
    \filldraw[white](135:6pt)arc(135:45:6pt)--(45:7.9pt)arc(45:135:7.9pt)--cycle;
    \draw[line width=0.6pt,black](0,0)circle[radius=8pt];
    \draw[line width=0.6pt,black](180:8pt)--(0:8pt);
    \filldraw[line width=0.6pt,white,draw=black](0,0)circle[radius=3pt];
    \filldraw[line width=0.1pt,black,draw=black](0,0)circle[radius=1.0pt];
  \end{scope}}
}}

\newtcolorbox{Mball}{%
  enhanced,colback=white,colframe=black,boxrule=0.6mm,enlarge top by=3.5mm,enlarge bottom by=2.0mm,overlay={%
\foreach \n in {north east,north west,south east,south west}{
  \begin{scope}[scale=1.0,rotate=0,shift=(frame.\n)]
  \filldraw[gray!70,draw=gray!70](1:7.8pt)arc(1:179:7.8pt)--cycle;;
  \filldraw[white,draw=white](-1:7.8pt)arc(-1:-179:7.8pt)--cycle;
  \draw[white,line width=0.6pt*0.8](120:4.4pt)--(105:6.0pt)--(90:4.9pt)--(75:6.0pt)--(60:4.4pt);
  \filldraw[black](115:7.8pt)to[out=-100,in=0](150:7.8pt)arc(150:115:7.8pt);
  \filldraw[black](65:7.8pt)to[out=-80,in=180](30:7.8pt)arc(30:65:7.8pt);
  \draw[line width=0.6pt,black](0,0)circle[radius=8pt];
  \draw[line width=0.6pt,black](180:8pt)--(0:8pt);
  \filldraw[line width=0.6pt,white,draw=black](0,0)circle[radius=3pt];
  \filldraw[line width=0.1pt,black,draw=black](0,0)circle[radius=1.0pt];
  \end{scope}}
}}

コンパイル

コンパイルの例です。 www.overleaf.com