その他一覧へ戻る

黒板出力

鉄TeX機能紹介/TikZサンプル/黒板出力.tex鉄TeX機能紹介 / TikZhybrid

レンダリング結果

2ページ / 同名PDFあり
黒板出力 preview
黒板出力 preview
PDFを開く
TeXソース
TeXソース
入力コード
\documentclass[usegreek,userussian]{tetsujsarticle}
\usepackage{tetsuryoku}

\makeatletter

\def\黒板消し#1{%
  \node[chamfered rectangle, fill=black!10,
		chamfered rectangle corners={north east, north west},
		chamfered rectangle xsep=1,
		inner sep=1, outer sep=0,
        minimum width=40, minimum height=2,
        above
  ] at #1 {};
  \node[chamfered rectangle, fill=black!80,
		chamfered rectangle corners={south east, south west},
		chamfered rectangle xsep=1,
		inner sep=1, outer sep=0,
        minimum width=36, minimum height=8,
        below
  ] at #1 {};
  \draw[line width=2,xshift=-2] #1 .. controls ($#1+(0,10)$) and ($#1+(5,10)$) .. +(5,4);
}


\def\黒板出力{\@ifnextchar|{\@黒板出力}{\@黒板出力|重要事項|}}
\long\def\@黒板出力|#1|{\@ifnextchar({\@@黒板出力|#1|}{\@@黒板出力|#1|()}}
\long\def\@@黒板出力|#1|(#2){\@ifnextchar[{\@@@黒板出力|#1|(#2)}{\@@@黒板出力|#1|(#2)[\linewidth]}}
\long\def\@@@黒板出力|#1|(#2)[#3]#4{%
  \setlength{\@tempdimp}{#3}%
  \setlength{\@tempdimx}{\@tempdimp-\黒板左余白-\黒板右余白-2\黒板左右出っ張り}%
  \setbox5\hbox{\begin{minipage**}{\@tempdimx}\sffamily#4\end{minipage**}}%
  \setlength{\@tempdimv}{\ht5+\dp5}%
  \begin{center}%
  \begin{tikzpicture}[x=1pt,y=1pt,every node/.style={color=white, inner sep=0}]
  \fill[color=gray!90] (\黒板左右出っ張り,0) rectangle (\@tempdimp-\黒板左右出っ張り,\@tempdimv+\黒板上余白+\黒板下余白);
  \draw[color=black,line width=2pt] (0,0) -- +(\@tempdimp,0);
  \draw[color=black,line width=2pt] (0,\the\@tempdimv+\黒板上余白+\黒板下余白) -- +(\@tempdimp,0);
  \node[anchor = south west] at (\黒板左右出っ張り+\黒板左余白,\黒板下余白) {\usebox5};
  \黒板消し{(\黒板左右出っ張り+\黒板左余白+\黒板消しの引っ込み,10)}
  \黒板消し{(\@tempdimp-\黒板左右出っ張り-\黒板右余白-\黒板消しの引っ込み,10)}
  \node[anchor=south] at (\@tempdimp-\黒板左右出っ張り-0.5*\黒板右余白,20) {#2};
  \node [color=black, font=\HUGE, inner sep=4, 
         fill=gray!20, draw, thick,
         decorate, decoration={random steps,segment length=3pt,amplitude=1pt}
    ] at (.5*\@tempdimp, \@tempdimv+\黒板上余白+\黒板下余白+30)
    {\YOzMouhitsuGyoushoAntiqueBold{#1}};
  \end{tikzpicture}
  \end{center}
}
\makeatother

\begin{document}

\ldef\黒板左余白{20pt}
\ldef\黒板右余白{20pt}
\ldef\黒板上余白{20pt}
\ldef\黒板下余白{30pt}
\ldef\黒板左右出っ張り{10pt}
\ldef\黒板消しの引っ込み{60pt}

\黒板出力{変数は消えても変域は残る}

\vfil


\黒板出力|日々是決戦|{こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。}

\vfil

\ldef\黒板右余白{80pt}

\黒板出力|常在戦場|(\parbox<t>{9zw}{\large\kanjiskip.2zw\relax\gtfamily 5月4日\\鉄本 緑太郎}){こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。こんばんは。ぼくドラえもんです。}

\vfil

\黒板出力|文法解説|(\parbox<t>{14zw}{\large\kanjiskip1zw\relax\gtfamily 5月4日\\鉄本 緑太郎})[\linewidth-5zw]{\lipsum[1-2]}



\end{document}