%%%==============================================================================
% WinEdt pragmas
% !Mode:: "TeX:EN"
% Default Compile engines:
% !TEX program = pdflatex
% !PDFTeXify ext =  --enable-etex  --restrict-write18
% !PDFLaTeX ext  =  --enable-etex  --restrict-write18
% !BIB program = none
%%%==============================================================================
%% Copyright 2023 by Alceu Frigeri
%%
%% This work may be distributed and/or modified under the conditions of
%%
%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
%%   version 1.3c (or later), and/or
%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
%%   version 3 (or later)
%%
%% This work has the LPPL maintenance status *maintained*.
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
%% This is version {2.1} {2025/10/06}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/tikzquests
%%
%%%==============================================================================
\documentclass[10pt]{article}
\RequirePackage[verbose,a4paper,marginparwidth=27.5mm,top=2.5cm,bottom=1.5cm,hmargin={40mm,20mm},marginparsep=2.5mm,columnsep=10mm,asymmetric]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{codedescribe}
\usepackage{tikzquests}
\RequirePackage[inline]{enumitem}
\SetEnumitemKey{miditemsep}{parsep=0ex,itemsep=0.4ex}

\usepackage[american,siunitx,cuteinductors,smartlabels,arrowmos,EFvoltages,betterproportions]{circuitikz}
\usetikzlibrary{math}


\setnewcodekey{tikzquests}{letter={},
  keywd={
    Question,tikzQuestion,ftikzQuestion,
    defQuestion,defQuestionAlias,
    defRepository,SelectRepository,
    QuestionsList,QuestVal
    },
  emph3={tikz, keys},
  emph2={xtrakeys,xtraidx,no, defs,old, settings,no, alias,in, review, undef, color}
  }


\RequirePackage[hidelinks,hypertexnames=false]{hyperref}
\begin{document}
\tstitle{
  author={Alceu Frigeri\footnote{\tsverb{https://github.com/alceu-frigeri/tikzquests}}},
  date={\tsdate},
  title={The tikzquests package\break A parametric questions' repository\break Version \PkgInfo{tikzquests}{version}}
  }

\begin{typesetabstract}

This is a framework for building parametric questions' repositories, which can be further used to construct parametric questions for exams. Unlike other packages (for instance \tsobj[pkg,sep={or}]{exam,exam-n,exam-lite}) this doesn't try to enforce any pre-defined presentation format, focusing only on how to set a repository and use it.
\end{typesetabstract}

\tableofcontents



\section{Introduction}
One recurring problem when typesetting exams, specially in Engineering fields, is the need to have parameterized questions, specially parameterized schematics used in exam's questions. The intent of this is to allow the creation of such repositories (one or more) with 'easily' parameterized text and/or graphic (\tsobj[pkg]{tikz}) questions, without enforcing any style/format whatsoever, leaving it to the end user.

The package offers
\begin{itemize}
  \item A set of commands to create and use repositories,
  \item A set of commands to create and use 'questions' (code snippets) in a repository,
  \item Question's customization, parametrization, based on \tsobj[pkg]{keys} and a set of associated macros.
\end{itemize}

\section{Package Options}\label{package options}
\begin{describelist}{option}
\describe{xtrakeys}{This allows to expand the set of pre-defined (\tsobj[pkg]{keys}) keys. See \ref{parameters}.}
\describe{xtraidx}{This allows to expand the set of pre-defined (\tsobj[pkg]{keys}) indexes per key. See \ref{parameters}.}
\describe{no defs}{(default: false). This changes the parametrization strategy suppressing the creation of ``keys commands''.}
\describe{old settings}{(default: false). This changes the assignment behaviour when \tsobj[option]{no defs} is set.  See \ref{parameters}}
\describe{no alias}{(default: false). This suppress the creation of Question's aliases (see \ref{question definition}), handy when one wants to reduce the 'noise' when listing all currently known Questions.}
\describe{in review}{(default: false). When using a question (see \ref{question use}), the question's associated remarks and annotations will be printed as well, if any.}
\describe{undef color}{(default: red).  This sets the color used to indicated the use of a non defined parameter.  See \ref{parameters}.}
\end{describelist}
\begin{tsremark}
  The effective sets of \tsobj[key]{keys,indexes} are logged as a package info.
\end{tsremark}

\section{Repositories}\label{repositories}
Questions are stored in repositories. There is a pre-defined one, named \tsobj[option]{default}. Each repository has two sub-sets (a) a non-starred sub-set and (b) a starred sub-set. The rational behind it is to be able to separate the text part (e.g. the question enunciate) from the graphics part. It is suggested (but not enforced) to store the text part in the starred sub-set and the graphics part (\tsobj[pkg]{tikz}) in the non-starred sub-set. A repository can have an ``unlimited'' set of questions. 
\begin{tsremark}
  All commands defined in \ref{question use} can use both subsets, except \tsobj{\QuestionsList} which assumes the non-starred sub-set has only text code, whilst the starred sub-set has \tsobj[pkg]{tikz} commands.
\end{tsremark}

\begin{codedescribe}[code,update=2025/10/01]{\defRepository,\SelectRepository}
\begin{codesyntax}%
\tsmacro{\defRepository*}{new-repository}
\tsmacro{\SelectRepository}{repository}
\end{codesyntax}
\tsobj{\defRepository} creates a new Repository, \tsobj[marg]{new-repository}. The starred version also switches to it, making it the ``current default''.
\tsobj{\SelectRepository} activates \tsobj[marg]{repository} as the ``current default'' one.

It is possible to construct a tree of related repositories by using a slash, ``/'', like ``repoA'', ``repoA/subA'', ``repoA/subB'', ``repoA/subC'', which can be handy when listing the questions of a repository, see \ref{quest list}.
\end{codedescribe}

\begin{tsremark}
About repository's names: It can be almost anything, the name can contain strings normally not allowed in a macro name, like spaces, dots, two-dots and so on. an important exception the backslash is still an active character, meaning that if someone typesets \tsobj{\XYZ} as a repository, the value stored in \tsobj{\XYZ} will be used (if \tsobj{\XYZ} isn't defined this might raise a rather cryptic \LaTeXe\ error).
\end{tsremark}

\begin{tsremark}
Do not create a repository with an ending slash, like ``repoName/''. Given the way sub-repositories are defined, it will render impossible to list this repository questions, see \ref{quest list}
\end{tsremark}

\begin{tsremark}
  A warning is raised if the (deprecated) \tsobj{\defNewRepository} is called. Use \tsobj{\defRepository} instead.
\end{tsremark}

\begin{tsremark}
When creating a new repository, a warning is raised  in case \tsobj[marg]{new-repository} already exists. 
When Selecting a repository, an error is raised if \tsobj[marg]{repository} doesn't exists.
\end{tsremark}


\section{Questions}
As said, for each repository there are two sub-sets of questions (code snippets): starred ones, though for text (which may include \LaTeXe\ commands) and non starred ones though for graphics (for instance, to be used inside a \tsobj[pkg]{tikz} environment). 

Since the code re-factoring (version 2.0), the commands \tsobj{\defQuestion, \defQuestionAlias, \Question, \tikzQuestion, \ftikzQuestion} use/refer to the ``non-starred'' sub-set, while the commands \tsobj{\defQuestion*, \defQuestionAlias*, \Question*, \tikzQuestion*, \ftikzQuestion*} use/refer to the ``starred'' sub-set.

 All questions can be parameterized (see \ref{parameters} below) with a set of predefined keys.

\subsection{Defining a Question}\label{question definition}
\begin{codedescribe}{\defQuestion}
\begin{codesyntax}%
\tsobj{\defQuestion}\tsargs[oarg]{repository}\tsargs[marg]{quest-name,code}\tsargs[oarg]{remarks}
\tsobj{\defQuestion*}\tsargs[oarg]{repository}\tsargs[marg]{quest-name,code}\tsargs[oarg]{remarks}
\end{codesyntax}
\tsobj{\defQuestion} creates a new Question in \tsobj[oarg]{repository} (per default using the ``current active'' one). \tsobj[marg]{quest-name} will be the associated question key, for later reference. \tsobj[marg]{code} will be the corresponding Question's code. \tsobj[oarg]{remarks} is just a small note associated with the Question. It won't be normally used/typeset, except if the \tsobj[option]{in review} option is being used, or when using the command \tsobj{\QuestionsList}.

The starred version \tsobj{\defQuestion*} will create the question in the ``starred sub-set'', whilst the non starred one \tsobj{\defQuestion} will create the question in the ``non starred sub-set''. 
\end{codedescribe}
\begin{tsremark}
  Since the code re-factoring (version 2.0) all commands in \ref{question use} can use both sets of questions, with one exception: \tsobj{\QuestionsList} which assumes that the starred set stores text and the non-starred stores \tsobj[pkg]{tikz} graphics.
\end{tsremark}
\begin{tsremark}
About question's names: It can be almost anything, the name can contain strings normally not allowed in a macro name, like spaces, dots, two-dots and so on, including backslashes, meaning that if someone typesets \tsobj{\XYZ} as a question name, \tsobj{\XYZ} will be it's name: a backslash isn't an active character anymore and one can't use macros when defining a question's name.
\end{tsremark}

\begin{tsremark}
An error is raised if \tsobj[marg]{repository} doesn't exist. In case the \tsobj[marg]{quest-name} already exists, it's code is silently replaced by the new one.
\end{tsremark}


\begin{codedescribe}[code,update={2025/04/25}]{\defQuestionAlias}
\begin{codesyntax}%
\tsobj{\defQuestionAlias}\tsargs[oarg]{dst-repository}\tsargs[marg]{quest-alias}\tsargs[oarg]{org-repository}\tsargs[marg]{quest-name}
\tsobj{\defQuestionAlias*}\tsargs[oarg]{dst-repository}\tsargs[marg]{quest-alias}\tsargs[oarg]{org-repository}\tsargs[marg]{quest-name}
\end{codesyntax}
\tsobj{\defQuestionAlias} creates an alias, \tsobj[marg]{quest-alias} (at \tsobj[oarg]{dst-repository}), for a given question, \tsobj[marg]{quest-name} (from \tsobj[oarg]{org-repository}). The current active repository is used if none is specified. If only \tsobj[oarg]{dst-repository} is specified, the same repository is used for \tsobj[oarg]{org-repository}. As with \tsobj{\defQuestion}, the ``star'' refers the sub-set  being used.
\end{codedescribe}


\begin{tsremark}
Be aware that this will copy the question definition at the alias creation point.
\end{tsremark}

\begin{tsremark}
An error is raised if \tsobj[marg,sep=or]{dst-repository,org-repository,quest-name} doesn't exist.
\end{tsremark}


\subsection{Using a Question}\label{question use}
\begin{codedescribe}[code,update=2025/10/01]{\Question,\tikzQuestion,\ftikzQuestion}
\begin{codesyntax}%
\tsobj{\Question}\tsargs[oarg]{repository}\tsargs[marg]{quest-name}\tsargs[oarg]{key=value list}\tsargs[xarg]{annotation}
\tsobj{\tikzQuestion}\tsargs[parg]{scale}\tsargs[oarg]{repository}\tsargs[marg]{quest-name}\tsargs[oarg]{key=value list}\tsargs[xarg]{annotation}
\tsobj{\ftikzQuestion}\tsargs[parg]{scale}\tsargs[oarg]{repository}\tsargs[marg]{quest-name}\tsargs[oarg]{key=value list}\tsargs[xarg]{annotation}
\tsobj{\Question*}\tsargs[oarg]{repository}\tsargs[marg]{quest-name}\tsargs[oarg]{key=value list}\tsargs[xarg]{annotation}
\tsobj{\tikzQuestion*}\tsargs[parg]{scale}\tsargs[oarg]{repository}\tsargs[marg]{quest-name}\tsargs[oarg]{key=value list}\tsargs[xarg]{annotation}
\tsobj{\ftikzQuestion*}\tsargs[parg]{scale}\tsargs[oarg]{repository}\tsargs[marg]{quest-name}\tsargs[oarg]{key=value list}\tsargs[xarg]{annotation}
\end{codesyntax}
Those are the main commands to display a question. The star/non-star defines which sub-set  will be used. 
\tsobj{\Question} is the ``raw'' base variant, the question's code will be used, as is, in a local group. The starred version \tsobj{\Question*} is meant for text questions, whilst  the non-starred version \tsobj{\Question} is meant for the case one wants to use a different graphic engine (for instance SVG, instead of the \tsobj[pkg]{tikz} as in \tsobj{\tikzQuestion}). Note that this is just a suggestion, and not enforced.

The \tsobj{\tikzQuestion} will display the question's code inside a \tsobj[env]{tikzpicture} environment. And then, \tsobj{\ftikzQuestion} will further nest the code inside a \tsobj[env]{center} environment (preparing it to be used inside a floating environment).

The \tsobj[oarg]{annotation} will only be added if, and only if, the \tsobj[option]{in review} option is being used. The \tsobj[parg]{scale} factor, when present, is related to the current \tsobj{\textwidth}, so a factor of 0.25 will scale the width of the question to 1/4th of the text width. The \tsobj[oarg]{key=value list} is a set of \tsobj[pkg]{keys}, see \ref{parameters} below.
\end{codedescribe}
\begin{tsremark}
  Besides the key/parameters from \ref{parameters} there is a special key \tsobj[key]{tikz keys} which can be used to pass \tsobj[pkg]{tikz} specific parameters for the underlying environment, this key is ignored when using \tsobj[code,sep=or]{\Question,\Question*}.
\end{tsremark}
\begin{tsremark}[\color{red}Warning:]
  A Warning is raised if one uses the old (deprecated) \tsobj[code,sep=or]{\rawtikzQuestion,\textQuestion}. Use \tsobj{\Question} instead.
\end{tsremark}

\begin{tsremark}
An error is raised if \tsobj[marg]{repository} or \tsobj[marg]{quest-name} doesn't exist.
\end{tsremark}


\begin{codedescribe}[code,new=2025/10/03]{\QuestionsFmtList,\QuestionsList}\label{quest list}
\begin{codesyntax}%
\tsmacro{\QuestionsFmtList}[repositories list]{star-cmd,nonstar-cmd}
\tsmacro{\QuestionsList}[repositories list]{}
\end{codesyntax}
\tsobj[oarg]{repositories list} is a comma separated list of repositories. For each repository,  all Questions will be typeset in a \tsobj[env]{'describe'} alike environment. If no \tsobj[oarg]{repositories list} is supplied, all repositories will be listed.

\tsobj[marg]{star-cmd} will be used to typeset a ``star'' question, it can be any command that accepts an optional \tsobj[oarg]{repository} name and a mandatory \tsobj[marg]{quest-name}, like \tsmacro{\starcmd}[repository]{quest-name}.

Likewise \tsobj[marg]{nonstar-cmd} will be used to typeset a ``non star'' question (assuming the same syntax).

\tsobj{\QuestionsList[repo-list]} is a shortcut for

\tsobj{\QuestionsFmtList[repo-list]{\Question*}{\tikzQuestion(0.35)}}

\end{codedescribe}

\begin{tsremark}
If a \tsobj[oarg]{repositories list}'s term finishes with a slash, ``/'', it will be treated as a family of repositories and all sub-repositories will be listed too.
\end{tsremark}

\begin{tsremark}
An error is raised if any repository in \tsobj[marg]{repositories list} doesn't exist. To reduce the clutter (and number of questions listed) one should consider the use of the  \tsobj[option]{no alias} option.
\end{tsremark}

\section{Parameters as keys and auxiliary macros.}\label{parameters}

By default a set of \tsobj[pkg]{keys} and macros is defined as follow: \tsobj[marg]{ID}\tsobj[marg]{idx}. The predefined range of \tsobj[marg]{IDs} being \tsobj[key]{R,L,C,Z,Y,G,H,X,K,T,Q,D,EQ,V,I}. The predefined range of \tsobj[marg]{idx} spans from a, b, c up to z, aa, ab, ac up to az and, finally, ba, bb, bc up to bz. 
\begin{tsremark}
That means, one gets to use \tsobj[pkg]{keys} as, for example, Ra=200, Lca=500, Kbe=230 and so on. For each of the key's \tsobj[marg]{ID} there is (per default) a set of 3x26 keys. If one adds some 3 other \tsobj[marg]{idx} then one gets 6x26 keys per \tsobj[marg]{ID}.
\end{tsremark}
\begin{tsremark}
The \tsobj[marg]{ID}s can be extended with the \tsobj[option]{xtrakeys} option. For example with \tsverb[option]{xtrakeys={NN,B}}, each extra \tsobj[marg]{ID} will add 3x26 keys (per default).
\end{tsremark}
\begin{tsremark}
The \tsobj[marg]{idx}s can be extended with the \tsobj[option]{xtraidx} option. For instance with \tsverb[option]{xtraidx={f,g}} one gets fa, fb, fc up to fz, ga, gb, gc up to gz as well, a x26 set per extra idx.
\end{tsremark}

Unless the \tsobj[option]{no defs} option is used, a corresponding macro (with the same name) will also be defined. For example, there is a macro \tsobj{\Ra} associated with the key \tsobj[key]{Ra}.
All those macros/keys are initialized  as follow (math mode) \tsobj{\ensuremath{<ID>_{<idx>}}}, resulting in $ID_{idx}$. So, for example, the key \tsobj[key]{Rab}, which can be accessed with the macro \tsobj{\Rab},  will be predefined as $R_{ab}$, \tsobj[key]{Lca} (\tsobj{\Lca}) will be predefined as $L_{ca}$, and so on.

The idea is that, when using the commands in \ref{question use}, if one doesn't specify a \tsobj[oarg]{key=value list}, the default values will be en force, and all one has to do (to change those values) is to set said list, which doesn't have to be complete, non assigned keys will keep their default value.

Besides those default keys, one can set and use any key at will (in \tsobj[oarg]{key=value list}) non-existing keys will be created ``on the fly'' with the given name as the default value.

\subsection{Assigning a value to pre-defined keys}
In fact, with each and every predefined key there are 3 ways to assign a value to it \tsobj[oarg]{key}\,=\tsobj[value]{value}, \tsobj[oarg]{key*}\,=\tsobj[value]{value} and \tsobj[oarg]{key raw}\,=\tsobj[value]{value}. The difference being that \tsobj[oarg]{key raw} will assign whatever code/value to the key (and associated macro), \tsobj[oarg]{key*} will assign the code/value inside a math environment. 
\begin{tsremark}[\color{red}warning:]
\tsobj[oarg]{key}\,=\tsobj[value]{value} (without any specifier) will be the same as \tsobj[oarg]{key*} (default). But, if the options \tsobj[option]{no defs,old settings} are used, it will be equivalent to \tsobj[oarg]{key raw}.
\end{tsremark}

\subsection{Assigning a value to new keys}
When using  \tsobj[oarg]{key}\,=\tsobj[value]{value}, if the \tsobj[oarg]{key} isn't one of the pre-defined ones, then \tsobj[value]{value} will be assigned ``as is'' to \tsobj[oarg]{key}.
\begin{tsremark}[\color{red}warning:]
Note that, in this case there are no \tsobj[oarg,sep=or]{key*,key raw} equivalents. 
\end{tsremark}

\subsection{Using a parameter key}
When defining the \tsobj[marg]{code} of a question (see \ref{question definition}) one has two options to recover a key's value:
\begin{itemize}
  \item A macro named after the key itself (in case of the default keys, see above) and, or
  \item the \tsobj{\QuestVal} command which allows to recover the value of both the default keys, as well as the ones defined on the fly.
\end{itemize}
\begin{tsremark}[\color{red}Warning:]
If the option \tsobj[option]{no defs} is used, the only option to recover a key's value is \tsobj{\QuestVal}. Users are advised to choose a style, and keep it (when starting new docs).
\end{tsremark}


\begin{codedescribe}[code,EXP]{\QuestVal}
\begin{codesyntax}%
\tsmacro{\QuestVal}{IDidx}
\tsmacro{\QuestVal}{key}
\end{codesyntax}
This will always recover the value of a key, regardless if the key is one of the pre-defined ones (in the form \tsobj[marg]{IDidx} or an ``on the fly'' new one, \tsobj[marg]{key}.
If the key didn't get (re)defined with the \tsobj[oarg]{key=value list}, it will return the key/parameter default value. In the case of a ``on the fly'' key, it will be the key's name in red (or the color set up with the \tsobj[option]{undef color} option, see \ref{package options}).

\end{codedescribe}
\begin{tsremark}
  \tsobj{\QuestVal} is fully expandable, if the key's code also is.
\end{tsremark}

\section{Examples of Use}



\subsection{Package Options}
\begin{codestore}[pack.options A]
\usepackage{tikzquests}
\end{codestore}

\tscode*[tikzquests,codeprefix={Package Options}]{pack.options A}
This is the default case, in which both \tsobj{\QuestVal} and (for default keys) associated macro name can be used to retrieve a key/parameter value.

\begin{codestore}[pack.options B]
\usepackage[xtrakeys={EX,N},xtraidx={f,h},undef color={blue},no defs]{tikzquests}
\end{codestore}

\tscode*[tikzquests,codeprefix={Package Options}]{pack.options B}

In this case, one will get the following set of keys

\begin{itemize}[nosep]
\item Ra, Rb ... Rz, Rab, Rab ... Raz .... \emph{Rfa, Rfb ... Rfz, Rha, Rhb ... Rhz}
\item .... all other default sets of keys, plus
\item EXa, EXb ... EXz, EXab, EXab ... EXaz .... \emph{EXfa, EXfb ... EXfz, EXha, EXhb ... EXhz}
\item Na, Nb ... Nz, Nab, Nab ... Naz .... \emph{Nfa, Nfb ... Nfz, Nha, Nhb ... Nhz}
\end{itemize}

Besides that, the undefined color will be blue and no additional macro will be defined, meaning that \tsobj{\QuestVal} is the only option to retrieve the value of a key/parameter.

\begin{codestore}[pack.options C]
\usepackage[no alias, in review]{tikzquests}
\end{codestore}

\tscode*[tikzquests,codeprefix={Package Options}]{pack.options C}
In this case, no alias will be defined (the command \tsobj{\defQuestionAlias} will be ignored), and when using \tsobj{\tikzQuestion} (and similar) the question's remarks (defined by \tsobj{\defQuestion}) and annotations (from \tsobj{\tikzQuestion}) will be printed. The \tsobj[option]{no alias} is specially useful when using the command \tsobj{\QuestionsList}.

\subsection{A More Complete Example}
In the following code, an extra repository will be set (besides the default one) and two questions (a starred, text, and non starred, graphics) will be defined for each repository.

\begin{codestore}[DefQuestion]
% A repository name can be just about anything.
% the star makes sure 'Repo 2' is now the active/default one.
\defRepository*{Repo 2} 

% quest names are even more flexible than a repository one
% the star implies this is a text one.
\defQuestion*{Quest A:1}{
 In the following circuit, assuming $\beta \approx \QuestVal{Beta}$ and that $V_{be} \approx 0.65V$, find the value of $R_c$ such that the small signal gain is \QuestVal{Gain}.
}[That would be a question enunciate.]

%% Note the use of the macros \Ra, \Rb, \Rc, \Rd, \Vi, \Vbc and \Vo 
\defQuestion[Repo 2]{Elect. 1a}{
		\draw
		(0,0) coordinate(A) to[V,invert,l=\Vi] ++(0,3) coordinate(V)
      to[R=\Ra] ++(2,0) 
      to[C] ++(2,0) coordinate(B) 
      -- ++(1,0) node[npn,anchor=B] (T1){}
		(A) -- (A -| B) coordinate(Ba) to[R=\Rb] (B) to[R=\Rg] ++(0,3) coordinate(C)
    (B) node[circ]{}
		(T1.E) to[R,l=\Rc] (T1.E |- A) -- (A)
		(T1.C) to[R,l_=\Rd] (T1.C |- C) -- (C -| A) -- ++(-2,0) coordinate(X) to[V,l=\Vbc] (X |- A) -- (A)
    (T1.C) -- ++(1.5,0) node[ocirc]{} coordinate(k) to[open,v=\Vo] (k |- A) node[ocirc]{} -- (A)
		 ;
}[this is a CircuiTikZ example]

%switching repositories
\SelectRepository{default} 

% Note that, since this is a different repository, there is no name crashing.
\defQuestion*{Quest A:1}{
 In the following circuit, assuming $\beta \approx \QuestVal{Beta}$ and that $V_{be} \approx 0.65V$, find the value of \Rg \ such that the DC level of \Vo \ is equal to \QuestVal{DC level}.
}[Just for the sake of it.]

%% Note the use of the macros \Ra, \Rb, \Rc, \Rd, \Vi, \Vbc and \Vo 
\defQuestion{Elect. 1b}{
		\draw
		(0,0) coordinate(A) to[V,invert,l=\Vi] ++(0,3) coordinate(V)
      to[R=\Ra] ++(2,0) 
      to[C] ++(2,0) coordinate(B) 
      -- ++(1,0) node[pnp,anchor=B] (T1){}
		(A) -- (A -| B) coordinate(Ba) to[R=\Rb] (B) to[R=\Rg] ++(0,3) coordinate(C)
    (B) node[circ]{}
		(T1.C) to[R,l=\Rc] (T1.C |- A) -- (A)
		(T1.E) to[R,l_=\Rd] (T1.E |- C) -- (C -| A) -- ++(-2,0) coordinate(X) to[V,l=\Vbc] (X |- A) -- (A)
    (T1.C) -- ++(1.5,0) node[ocirc]{} coordinate(k) to[open,v=\Vo] (k |- A) node[ocirc]{} -- (A)
		 ;
}[this is a CircuiTikZ example]
\end{codestore}

\tscode*[tikzquests,codeprefix={Defining Questions},resultprefix={Result: \emph{no output}},emph={Ra,Rb,Rc,Rd,Rg,Vi,Vbc,Vo,Beta,Gain,raw,DC,level}]{DefQuestion}

\tsexec{DefQuestion}


Once Questions are defined one can use them, for instance, using just the default parameter's values.

\begin{codestore}[QuestionDefault]
Choose one of the following two questions:

\begin{enumerate}
  \item \Question*[Repo 2]{Quest A:1}<just a last minute note about this>\par
  \ftikzQuestion(0.4)[Repo 2]{Elect. 1a}
  
  \item \Question*[default]{Quest A:1}<just for the sake of it...>\par
  \ftikzQuestion(0.4)[default]{Elect. 1b}
\end{enumerate}
\end{codestore}

\tscode*[tikzquests, codeprefix={Questions Defaults},resultprefix={},  emph={Ra,Rb,Rc,Rd,Rg,Vi,Vbc,Vo,Beta,Gain,raw,DC,level}]{QuestionDefault}


\hrule\relax\vspace{0.5ex}

\tsexec{QuestionDefault}


Finally, one can use these same questions, setting it's parameters:

\begin{codestore}[QuestionUse]
Choose one of the following two questions:

\begin{enumerate}
  \item \Question*[Repo 2]{Quest A:1}[Beta=200,Gain=4,Ra=50\Omega]<just a last minute note about this>\par
  \ftikzQuestion(0.4)[Repo 2]{Elect. 1a}[Ra=50\Omega,Rb*=100\Omega,Rg raw=$100\Omega$,Rc=100\Omega,Rd=R_c,Vbc=18V,Vi=v_i(t),Vo=v_o(t),tikz keys={thick,red}] %%Note the use of the 'tikz keys' key...
  
  \item \Question*[default]{Quest A:1}[Beta=200,DC level=8V,Rg=R_{b1},Vo=v_o(t)]<just for the sake of it...>\par
  \ftikzQuestion(0.4)[default]{Elect. 1b}[Ra=50\Omega,Rb*=100\Omega,Rg=R_{b1},Rc=100\Omega,Rd=200\Omega,Vbc=18V,Vi=v_i(t),Vo=v_o(t)]
\end{enumerate}
\end{codestore}

\tscode*[tikzquests, codeprefix={Questions Using Parameters},resultprefix={Result: \emph{no output}},emph={Ra,Rb,Rc,Rd,Rg,Vi,Vbc,Vo,Beta,Gain,raw,DC,level}]{QuestionUse}

\hrule\relax\vspace{0.5ex}

\tsexec{QuestionUse}

\subsection{Listing all Questions}
To round it up, using the \tsobj{\QuestionsList} (see \ref{question use}):
\begin{codestore}[Qlist]
\QuestionsList
\end{codestore}

\tscode*[tikzquests]{Qlist}

One get's: 

\tsexec{Qlist}



\end{document} 