summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/webquiz/latex/webquiz-doc.code.tex
blob: 2a078b8bdbd1686cb402c271e319e760464d5f83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
%-----------------------------------------------------------------------------
%  Copyright (C) 2004-2019 Andrew Mathas, University of Sydney
%
%  Distributed under the terms of the GNU General Public License (GPL)
%                  http://www.gnu.org/licenses/
%
% This file is part of the WebQuiz system.
%
% <Andrew.Mathas@sydney.edu.au>
%-----------------------------------------------------------------------------

% common latex code in the documentation files
\RequirePackage{cmap} % fix search and cut-and-paste in Acrobat

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}

\RequirePackage{enumitem}
\setlist[itemize]{nosep}
\setlist[description]{
    font=\sffamily\bfseries\color{DodgerBlue},
    labelwidth=\textwidth
}

\RequirePackage{graphicx}

\RequirePackage{xspace}
\RequirePackage[svgnames]{xcolor}

\usepackage{hologo}
\newcommand\TeXfht{\href{https://www.ctan.org/tex4ht}{\hologo{TeX4ht}}\xspace}

\NewDocumentCommand\ctan{ O{pkg/#2} m}{\href{https://www.ctan.org/#1}{\texttt{#2}}\xspace}

\newcommand\HTML{\href{https://www.w3schools.com/html/html_intro.asp}{HTML}\xspace}
\newcommand\CSS{\href{https://www.w3schools.com/css}{CSS}\xspace}
\newcommand\XML{\href{https://www.w3schools.com/xml/xml_whatis.asp}{XML}\xspace}
\newcommand\Javascript{\href{https://www.w3schools.com/Js/}{Javascript}\xspace}
\newcommand\python[1][python]{\href{https://www.python.org/}{#1}\xspace}
\newcommand\Ghostscript{\href{https://www.ghostscript.com/}{Ghostscript}\xspace}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% listings code for python and latex examples in webquiz documentation
\RequirePackage{listings}
\lstset{%
    % Basic design
    backgroundcolor=\color{LightYellow!50!White},
    basicstyle={\small\ttfamily},
    boxpos=c, % centered
    % frame
    framerule=2pt,
    frame=l,
    framerule=0.5mm,
    rulesep=10mm,
    rulecolor=\color{Peru},
    breaklines=true,
    % colours for keywords etc
    commentstyle=\color{DarkRed},
    keywordstyle=\color{MediumBlue},
    linewidth=14cm,
    basewidth  = {.5em,0.5em},
    numbers=none,
    resetmargins=true,
    tabsize=2,
    xleftmargin=10mm,
    classoffset=1,
    % Code design
    keywordstyle={[1]\color{Blue}\bfseries},
    keywordstyle={[2]\color{ForestGreen}},
    keywordstyle={[3]\color{LimeGreen}},
    keywordstyle={[4]\color{DarkBlue}},
    commentstyle=\color{BurlyWood}\ttfamily,
    stringstyle=\color{Coral},
    tabsize=4,
    showtabs=false,
    showspaces=false,
    showstringspaces=false,
    inputencoding=utf8,
    extendedchars=true,
    literate={á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
      {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
      {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1
      {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
      {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
      {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
      {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
      {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
      {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
      {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1
      {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
      {€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1
      {»}{{\guillemotright}}1{ñ}{{\~n}}1{Ñ}{{\~N}}1{¿}{{?`}}1
      {á}{{\'a}}1{í}{{\'i}}1{é}{{\'e}}1{ý}{{\'y}}1{ú}{{\'u}}1{ó}{{\'o}}1
      {ě}{{\v{e}}}1{š}{{\v{s}}}1{č}{{\v{c}}}1{ř}{{\v{r}}}1{ž}{{\v{z}}}1{ď}{{\v{d}}}1
      {ť}{{\v{t}}}1{ň}{{\v{n}}}1{ů}{{\r{u}}}1{Á}{{\'A}}1{Í}{{\'I}}1{É}{{\'E}}1
      {Ý}{{\'Y}}1{Ú}{{\'U}}1{Ó}{{\'O}}1{Ě}{{\v{E}}}1{Š}{{\v{S}}}1{Č}{{\v{C}}}1
      {Ř}{{\v{R}}}1{Ž}{{\v{Z}}}1{Ď}{{\v{D}}}1{Ť}{{\v{T}}}1{Ň}{{\v{N}}}1{Ů}{{\r{U}}}1
}
\lstdefinestyle{latexcode}{
  language=[LaTeX]TeX,
  texcsstyle=*\bfseries\color{DodgerBlue},
  classoffset=1,
  morekeywords={UnitCode,UnitName,UnitURL,QuizzesURL,BreadCrumbs,BreadCrumb,Department,DepartmentURL,
                includegraphics,DeclareGraphicsExtensions,DisplayAsImage,thechoice,quiz,
                Institution,InstitutionURL,feedback,correct,incorrect,whenRight,whenWrong,answer,
                dref, qref, Qref},
  classoffset=2,
  morekeywords={quizindex, discussion, question, multiple, single, columns, choice},
  classoffset=3,
  alsoletter=2,
  morekeywords={theme, language, hide side menu, pst2pdf, tikz, fixed order, random order,
                show side menu, one page, separate pages, english, french, integer, complex,
                number, string, lowercase, pspicture},
  classoffset=4,
  morekeywords={tikzset, foreach, draw, filldraw, Configure, NewConfigure, csdef, csletcs, csuse,
                Picture, EndPicture, psplotThreeD, pstThreeDCoor, RequirePackage, DeclareGraphicsExtensions},
}
\lstnewenvironment{latexcode}{\lstset{style=latexcode}}{}
\NewDocumentCommand\LatexCode{v}{\lstinline[style=latexcode]|#1|}
\NewDocumentCommand\InputLatexCode{ O{examples/} m}{\lstinputlisting[style=latexcode]{#1#2}}

\lstdefinestyle{bashcode}{
  language=bash,
  upquote=true,
  classoffset=1,
  morekeywords={webquiz, kpsewhich, latex, pdflatex, xelatex. lualatex},
  classoffset=2,
  morekeywords={>}
}
\lstnewenvironment{bashcode}{\lstset{style=bashcode}}{}
\NewDocumentCommand\BashCode{v}{\lstinline[style=bashcode]|#1|}
\newcommand\InputBashCode[1]{\lstinputlisting[style=bashcode]{#1}}

\lstdefinestyle{pythoncode}{
  language=HTML,
  upquote=true,
  classoffset=1,
  morekeywords={quiz_page},
}
\lstnewenvironment{pythoncode}{\lstset{style=pythoncode}}{}
\NewDocumentCommand\PythonCode{v}{\lstinline[style=pythoncode]|#1|}
\newcommand\InputPythoCode[1]{\lstinputlisting[style=pythoncode]{#1}}

\lstdefinestyle{htmlcode}{
  language=HTML,
  upquote=true,
  morekeywords={no}
  classoffset=1,
  morekeywords={quiz_page, side_menu, quiz_questions, quiz_header, no_script, include, breadcrumbs,},
}
\lstnewenvironment{htmlcode}{\lstset{style=htmlcode}}{}
\NewDocumentCommand\HTMLCode{v}{\lstinline[style=htmlcode]|#1|}

\newcommand\DefaultValue[1]{\textcolor{ForestGreen}{\texttt{#1}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{tcolorbox}
\tcbuselibrary{skins}
\NewDocumentCommand\ScreenShot{ O{0.7} m O{examples/} m }{%
  \begin{center}
    \begin{tcolorbox}[width=#1\textwidth, title=#2, arc=3mm,
      colframe=Peru,
      boxrule=0.2mm,
      colback=white,
      halign=center,
      enhanced,
      attach boxed title to bottom right={yshift=3mm, xshift=-3mm},
      fonttitle=\footnotesize,
      boxed title style={size=fbox, colback=white, arc=2mm},
      coltitle=Peru,
    ] \includegraphics[width=\textwidth]{#3#4}
    \end{tcolorbox}
  \end{center}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% hyperref settings

\AtEndPreamble{
  \RequirePackage{hyperref}
  \hypersetup{%
      colorlinks=true,
      linkcolor=SaddleBrown,
      urlcolor=Brown,
      pdfauthor   = {\webquiz{authors}                       },
      pdfkeywords = {\webquiz{keywords}                      },
      pdfsubject  = {\webquiz{description}                   },
      pdfinfo     = {%
          copyright    = {\webquiz{copyright}},
          licence      = {\webquiz{licence}},
          release date = {\webquiz{release date}},
          url          = {\webquiz{url}},
      }
  }
}
\endinput