その他一覧へ戻る

解答欄生成

鉄TeX機能紹介/TikZサンプル/解答欄生成.tex鉄TeX機能紹介 / TikZhybrid

レンダリング結果

1ページ / 同名PDFあり
解答欄生成 preview
PDFを開く
TeXソース
TeXソース
入力コード
\documentclass[b4j,landscape,twocolumn]{tetsujsarticle}

\usepackage{chem-soufuku}

\renewcommand{\章タイトル}{第9章 炭化水素 / 第10章 脂肪族化合物}
\renewcommand{\試験時間}{35}

\begin{document}

\ここから解答用紙

\大問

\br{.5}

\makeatletter

\setlength{\@tempdimf}{1pt*\ratio{\linewidth}{1zw}}%
\removept\@tempdimf\linew

\def\下ベクトル{+(0,-\lineh)}

\def\小問#1{\draw (0,0) -- +(\linew, 0)
      (0,0) rectangle (\解答横幅,-\lineh)
      (\解答横幅/2,-\lineh/2) node {#1}
      ;
}
\def\小小問#1{
  \draw 
      (\解答横幅 + \i*\linew/#1 - \i*\解答横幅/#1, 0) ++(\解答横幅sub,0) -- \下ベクトル
      ++(\linew/#1 - \解答横幅/#1 - \解答横幅sub, 0)  -- \下ベクトル
      -- +(-\linew/#1 + \解答横幅/#1, -\lineh)
      (\解答横幅+\解答横幅sub/2 + \i*\linew/#1 - \i*\解答横幅/#1, -\lineh/2) node {\gb{\kigou}}
      ;
}


\def\解答横幅{0}
\def\解答横幅sub{2}

\noindent
\begin{tikzpicture}[x=1\Cwd,y=1\Cwd]
\def\lineh{4}
\draw (0,0) rectangle (\linew,-\lineh);
\foreach \i/\kigou in {0/ア, 1/イ, 2/ウ} {\小小問{3}}
\draw[dotted] (\linew*2/3 + \解答横幅sub + 1/2*\linew/3-1/2*\解答横幅sub, 0) -- \下ベクトル;
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{10}
\draw (0,0) -- \下ベクトル;
\foreach \i/\kigou in {0/エ} {\小小問{3}}
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{4}
\draw (0,0) rectangle (\linew,-\lineh);
\foreach \i/\kigou in {0/オ, 1/カ, 2/キ} {\小小問{3}}
\foreach \i in {1,2,3,4} {
  \draw[dotted] (\linew/3 + \解答横幅sub + \i/5*\linew/3-\i/5*\解答横幅sub, 0) -- \下ベクトル;
}
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{4}
\draw (0,0) -- \下ベクトル;
\foreach \i/\kigou in {0/ク, 1/ケ, 2/コ} {\小小問{3}}
\foreach \i in {1,2} {
  \draw[dotted] (\linew/3 + \解答横幅sub + \i/3*\linew/3-\i/3*\解答横幅sub, 0) -- \下ベクトル;
}
\end{scope}
\end{scope}
\end{scope}
\end{tikzpicture}


\大問

\br{.5}

\def\解答横幅{3}
\def\解答横幅sub{2}

\noindent
\begin{tikzpicture}[x=1\Cwd,y=1\Cwd]
\def\lineh{4}
\小問{問1}
\foreach \i/\kigou in {0/ア, 1/イ, 2/ウ} {\小小問{3}}
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{18}
\draw (0,0) rectangle ++(\linew,-\lineh)
      rectangle ++(-18,4)
      rectangle +(2,-4)
      +(1,-2) node {\gb{答}}
      (\解答横幅,0) -- \下ベクトル
      (\解答横幅,0) rectangle +(4,-2)
      (\解答横幅/2,-\lineh/2) node {問2}
      (\解答横幅+2,-1) node {\gb{考え方}}
      ;
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{4}
\draw (0,0) rectangle (\linew,-\lineh)
      (\解答横幅,0) -- \下ベクトル
      (\解答横幅/2,-\lineh/2) node {問3}
      ;
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{8}
\draw (0,0) rectangle (\linew,-\lineh)
      (\解答横幅,0) -- \下ベクトル
      (\linew/2 ,0) -- \下ベクトル
      (\linew/2 + \解答横幅 ,0) -- \下ベクトル
      (\解答横幅/2,-\lineh/2) node {問4}
      ++(\linew/2, 0) node {問5}
      ;
\end{scope}
\end{scope}
\end{scope}
\end{tikzpicture}


\大問

\br{.5}

\def\解答横幅{3}
\def\解答横幅sub{2}

\noindent
\begin{tikzpicture}[x=1\Cwd,y=1\Cwd]
\def\lineh{4}
\draw (0,0) rectangle (\linew,-\lineh)
      (\解答横幅,0) -- \下ベクトル
      (\解答横幅/2,-\lineh/2) node {問1}
      ;
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{4}
\foreach \i/\kigou in {0/ア, 1/イ} {\小小問{2}}
\小問{問2}
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{30}
\小問{問3}
\begin{scope}
\def\lineh{6}
\foreach \i/\kigou in {0/A, 1/B, 2/C} {\小小問{3}}
\begin{scope}[yshift=-\lineh\Cwd]
\foreach \i/\kigou in {0/D, 1/E, 2/F} {\小小問{3}}
\begin{scope}[yshift=-\lineh\Cwd]
\foreach \i/\kigou in {0/G, 1/H, 2/I} {\小小問{3}}
\begin{scope}[yshift=-\lineh\Cwd]
\foreach \i/\kigou in {0/J, 1/M, 2/N} {\小小問{3}}
\begin{scope}[yshift=-\lineh\Cwd]
\foreach \i/\kigou in {0/O, 1/Q} {\小小問{3}}
\end{scope}
\end{scope}
\end{scope}
\end{scope}
\end{scope}
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{4}
\小問{問4}
\foreach \i/\kigou in {0/K, 1/L, 2/P, 3/R} {\小小問{4}}
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{12}
\小問{問5}
\begin{scope}
\def\lineh{4}
\foreach \i/\kigou in {0/A, 1/B, 2/C, 3/D} {\小小問{4}}
\begin{scope}[yshift=-\lineh\Cwd]
\foreach \i/\kigou in {0/E, 1/F, 2/L, 3/N} {\小小問{4}}
\begin{scope}[yshift=-\lineh\Cwd]
\foreach \i/\kigou in {0/O, 1/Q} {\小小問{4}}
\end{scope}
\end{scope}
\end{scope}
\begin{scope}[yshift=-\lineh\Cwd]
\def\lineh{12}
\小問{問6}
\draw (\解答横幅 + \解答横幅sub ,0) -- \下ベクトル;
\def\lineh{4}
{
\let\gb\relax
\foreach \i/\kigou in {0/$a$, 1/$b$, 2/$c$, 3/$d$} {\小小問{4}}
}
\begin{scope}[yshift=-\lineh\Cwd]
\draw (\解答横幅,0) rectangle ++(\linew/2-\解答横幅/2, -8)
      (\解答横幅,0) + (\解答横幅sub/2, -4) node {\gb{X}}
      ;
\end{scope}
\end{scope}
\end{scope}
\end{scope}
\end{scope}
\end{scope}
\end{tikzpicture}


\end{document}