summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/cesenaexam/cesenaexam.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-08-05 20:57:05 +0000
committerKarl Berry <karl@freefriends.org>2017-08-05 20:57:05 +0000
commit19f23660ffb017d26da264466d6ad957c800bd14 (patch)
treed24ba9beb9b3d1a152d19e01c7310a1128dbaab5 /Master/texmf-dist/tex/latex/cesenaexam/cesenaexam.sty
parent180ddd3112dacd2d1cd160d1ccdd872050f0e635 (diff)
cesenaexam (5aug17)
git-svn-id: svn://tug.org/texlive/trunk@44960 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/cesenaexam/cesenaexam.sty')
-rw-r--r--Master/texmf-dist/tex/latex/cesenaexam/cesenaexam.sty218
1 files changed, 218 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/cesenaexam/cesenaexam.sty b/Master/texmf-dist/tex/latex/cesenaexam/cesenaexam.sty
new file mode 100644
index 00000000000..1fb4dcee548
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/cesenaexam/cesenaexam.sty
@@ -0,0 +1,218 @@
+%%
+%% This is file `cesenaexam.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% cesenaexam.dtx (with options: `package,classpackage')
+%% ----------------------------------------------------------------
+%% cesenaexam --- class file to typeset exams
+%% E-mail: alexpacini90@gmail.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% Contributions to this repository as pull requests are welcome!
+%% ----------------------------------------------------------------
+%%
+%% This LaTeX document class has been designed to typeset exams.
+%% To make the .cls from the .dtx one, just run
+%% ```make```.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cesenaexam}[2017/08/03 - v0.2 Cesena Exam]
+\def\cesenaexamversion{0.2}
+%% Custom options
+\RequirePackage{etoolbox}
+%% I decided to use the etoolbox ifbool because the if else fi
+%% has issues with docstrip and needs a dirty hack
+%% tex.stackexchange.com/questions/162762
+%% No version option
+\newbool{exam@version}\booltrue{exam@version}
+%% Box the blocks option
+\newbool{exam@boxed}\boolfalse{exam@boxed}
+%% Times font option
+\newbool{exam@times}\boolfalse{exam@times}
+%% Loading graphicx before tikz removes a
+%% strange issue with the \graphicspath
+\RequirePackage[pdftex]{graphicx}
+%% Tikz and circuitikz
+\RequirePackage{tikz}
+\RequirePackage[betterproportions]{circuitikz}
+\usetikzlibrary{arrows.meta,arrows,intersections,%
+positioning,fit,calc,through,babel}
+\usetikzlibrary{decorations.pathmorphing,backgrounds}
+%% Some settings for Tikz
+\tikzset{switcharc/.style={draw, thick, >=stealth},
+ every picture/.append style={tight background,%
+ baseline={([yshift=-1em] current bounding box.north)}}}
+%% Redefine the section to have bigger font and to be
+%% delimited between two lines
+\RequirePackage{titlesec}
+\newcommand{\sectionfont}{\Large}
+\renewcommand\thesection{\bfseries \arabic{section}}
+\titleformat{\section}
+ {\titlerule
+ \vspace{0.5ex}%
+ \sectionfont}
+ {\thesection}{1em}
+ {\sectionfont \bfseries}[\titlerule]
+%% Redefine the enumerate item to be bold
+\renewcommand\labelenumi{\bfseries\theenumi.}
+%% Options for the titlebox processed from the
+%% maketitle optional arguments
+\pgfkeys{
+ /mytitlebox/.is family, /mytitlebox,
+ textboxheight/.default = 0.6cm,
+ whiteboxheight/.default = 1cm,
+ textboxheight/.store in = \minheighttext@title,
+ whiteboxheight/.store in = \minwhiteboxheight@title,
+ textboxone/.default = {\relax},
+ textboxtwo/.default = {\relax},
+ textboxthree/.default = {\relax},
+ textboxfour/.default = {\relax},
+ textboxone/.store in = \textboxone@title,
+ textboxtwo/.store in = \textboxtwo@title,
+ textboxthree/.store in = \textboxthree@title,
+ textboxfour/.store in = \textboxfour@title,
+ %% Executing them to assign the default value
+ %% (Tikz manual 82.3.2 or tex.stackexchange.com/questions/85754)
+ textboxheight, whiteboxheight, textboxone,
+ textboxtwo, textboxthree, textboxfour,
+}
+
+
+%% Define examsection and examsection*
+\def\examsection{\@ifstar\@examsection\@@examsection}
+\def\@examsection#1#2{\section*{#1 \textmd{(\textit{#2})}}\noindent}
+\def\@@examsection#1#2{\section{#1 \textmd{(\textit{#2})}}\noindent}
+%% Definition of empty tick box
+\newcommand{\boxempty}{$ \square \;$}
+%% Definition of empty tick box
+\newcommand{\boxcheck}{$ \blacksquare \;$}
+%% Assigns to ex@parts what is passed to the function examparts{}.
+%% Works similarly similarly to author{}
+\def\examparts#1{\def\ex@parts{#1}}
+%% Redefine maketitle
+%% Just for a future starred version
+\def\maketitle{\@ifstar\make@@title\make@title}%
+%% Define the unstarred version maketitle (make@title)
+\newcommand\make@title[6][]{%
+ \pgfkeys{/mytitlebox, #1}%
+ \make@@@title{#2}{#3}{#4}{#5}{#6}}%
+%% Define the common command
+\def\make@@@title#1#2#3#4#5{%
+\ifbool{exam@boxed}{%
+\tikzset{every picture/.append style={framed},%
+background rectangle/.style={draw=red}}}{}%
+\begin{center}%
+\begin{tikzpicture}%
+\pgfmathsetmacro{\boxlen}{(\textwidth-1.6cm)/4}%
+\pgfmathsetmacro{\lastboxlen}{\textwidth - 4*\boxlen - 1mm}%
+\node (surname) [draw, align=center, minimum width=\boxlen,%
+minimum height = \minheighttext@title] at (0,0) {\bf #1};%
+\node (surname box) [draw, anchor=north, minimum width=\boxlen,%
+minimum height = \minwhiteboxheight@title] at%
+($(surname.south)+(0,\pgflinewidth)$) {\textboxone@title};%
+\node (name) [draw, align=center, right=0 and -\pgflinewidth of surname,%
+minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #2};%
+\node (name box) [draw, anchor=north, minimum width=\boxlen,%
+minimum height = \minwhiteboxheight@title] at%
+($(name.south)+(0,\pgflinewidth)$) {\textboxtwo@title};%
+\node (id) [draw, align=center, right=0 and -\pgflinewidth of name,%
+minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #3};%
+\node (id box) [draw, anchor=north, minimum width=\boxlen,%
+minimum height = \minwhiteboxheight@title] at%
+($(id.south)+(0,\pgflinewidth)$) {\textboxthree@title};%
+\node (signature) [draw, align=center, right=0 and -\pgflinewidth of id,%
+minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #4};%
+\node (signature box) [draw, anchor=north, minimum width=\boxlen,%
+minimum height = \minwhiteboxheight@title] at%
+($(signature.south)+(0,\pgflinewidth)$) {\textboxfour@title};%
+%%
+\pgfmathsetmacro{\minheighttypebox}{\minheighttext@title +%
+\minwhiteboxheight@title}%
+\node (examtype) [draw, align=center, anchor=north west,%
+minimum width=\lastboxlen, minimum height = \minheighttypebox] at%
+($(signature.north east)+(-\pgflinewidth,0)$) {\Huge \bfseries #5};%
+\node (checkboxes) [align=left, anchor=north west] at%
+(surname box.south west) {\ex@parts};%
+\end{tikzpicture}%
+\end{center}%
+}
+%% Macro for two blocks centre aligned
+\def\examtwoblocks#1#2#3#4{%
+\noindent%
+\begin{minipage}[c]{#1}\flushleft#3\end{minipage}%
+\hfill%
+\begin{minipage}[c]{#2}#4\end{minipage}
+\par\vspace{5mm}\noindent%
+}
+\def\examtwoblocks@box#1#2#3#4{%
+\noindent%
+\tikzset{every picture/.append style={framed},
+ background rectangle/.style={draw=red}}%
+\let\bak@fboxsep\fboxsep%
+\def\fboxsep{0pt}%
+\fbox{\begin{minipage}[c]{#1}\flushleft#3\end{minipage}}%
+\hfill%
+\fbox{\begin{minipage}[c]{#2}#4\end{minipage}}%
+\let\fboxsep\bak@fboxsep%
+\par\vspace{5mm}\noindent%
+}
+\ifbool{exam@boxed}{%
+\renewcommand{\examtwoblocks}{\examtwoblocks@box}}{}
+%% Macro for two blocks top aligned
+\def\examtwoblockstop#1#2#3#4{%
+\noindent%
+\begin{minipage}[t]{#1}\flushleft#3\end{minipage}%
+\hfill%
+\begin{minipage}[t]{#2}\flushright#4\end{minipage}%
+}
+\def\examtwoblockstop@box#1#2#3#4{%
+\noindent%
+\tikzset{every picture/.append style={framed},
+ background rectangle/.style={draw=red}}%
+\let\bak@fboxsep\fboxsep%
+\def\fboxsep{0pt}%
+\fbox{\begin{minipage}[t]{#1}\flushleft#3\end{minipage}}%
+\hfill%
+\fbox{\begin{minipage}[t]{#2}\flushright#4\end{minipage}}%
+\let\fboxsep\bak@fboxsep%
+}
+\ifbool{exam@boxed}{%
+\renewcommand{\examtwoblockstop}{\examtwoblockstop@box}}{}
+%% Macro for one block top aligned
+\def\examoneblocktop#1#2{%
+\noindent%
+\begin{minipage}[t]{#1}\flushleft#2\end{minipage}}%
+\def\examoneblocktop@box#1#2{%
+\noindent%
+\tikzset{every picture/.append style={framed},
+ background rectangle/.style={draw=red}}%
+\let\bak@fboxsep\fboxsep%
+\def\fboxsep{0pt}%
+\fbox{\begin{minipage}[t]{#1}\flushleft#2\end{minipage}}%
+\let\fboxsep\bak@fboxsep%
+}
+\ifbool{exam@boxed}{%
+\renewcommand{\examoneblocktop}{\examoneblocktop@box}}{}
+
+%%
+%% Copyright (C) 2017 by Alex Pacini <alexpacini90@gmail.com>
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License (LPPL), either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in the file:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status) by
+%% Alex Pacini.
+%%
+%% This work consists of the file cesenaexam.dtx
+%% and the derived files cesenaexam.ins,
+%% cesenaexam.pdf and
+%% cesenaexam.cls.
+%%
+%%
+%% End of file `cesenaexam.sty'.