2
2
2
\RequirePackage{ifthen}
\RequirePackage{ntheorem}
\RequirePackage{longtable,xtab}
\RequirePackage{array}
\RequirePackage{multicol}
\RequirePackage{multirow}
\RequirePackage{enumerate}
\RequirePackage{fancyhdr}
\RequirePackage{answers}
\RequirePackage{tikz}
\RequirePackage{calc}
\usetikzlibrary{backgrounds}
\RequirePackage{etoolbox}
\RequirePackage{probsoln}
\RequirePackage{picinpar}
\RequirePackage{varwidth,mathrsfs}
\RequirePackage{filecontents,xstring}
\RequirePackage{expl3,xparse,epic,cntformats,xtemplate,environ}
\RequirePackage[shortlabels]{enumitem}
\let\Square\undefine
\RequirePackage{bbding}
%Fix immini
\def\thindent{}
%Fix in đáp án trắc nghiệm cho các môi trường vd, bt,...
\def\saveFileAns{}\def\keyEX{}\def\chType{0}
\newcommand{\fixshowans}[1]{%
\foreach \env in {#1} {%
\AtBeginEnvironment{\env}{%
\gdef\saveFileAns{}\gdef\keyEX{}\gdef\chType{0}%
\setcounter{dapan}{0}%
\def\dotEX{.}%
\setcounter{numTrueSol}{0}%
\AtEndEnvironment{\env}{%
\ifthenelse{\equal{\saveFileAns}{}}{}{
\Writetofile{ans}{\string\begin{Solution}{\Currentlabel}}%
\Writetofile{ans}{\saveFileAns^^J\string\end{Solution}}
\setcounter{numTrueSol}{0}%
\setcounter{numTrue}{0}%
\gdef\saveFileAns{}\gdef\keyEX{}\gdef\chType{0}%
\labelex%
\fixshowans{ex,bt,vd}
\newcommand{\dapso}[1]{\hspace{\fill}\mbox{}\linebreak[0]\hspace*{\fill}\textbf{ĐS:} #1}
\newcommand{\exitdapso}{\renewcommand{\dapso}[1]{\leavevmode\unskip}}%
\def\IMname{}
\def\IMlabel{}
\newcommand{\imlabel}[2]{%
\def\IMname{\refstepcounter{figure}\label{#2}}%
\def\IMlabel{Hình \thefigure: #1}%
%hide choice
\makeatletter
\newcommand{\hidechoice}[1]{%
\AtBeginEnvironment{#1}{\renewcommand{\choice}[5][]{}}%
\newcommand{\hidechoiceFT}[3][ex]{%
\AtBeginEnvironment{#1}{%
{\renewcommand{\choice}[5][]{}}{}%
%hideenviron
\newcommand{\hideenviron}[1]{\RenewEnviron{#1}{}}
\newdimen\linepar
\newlength{\paroutindent}
\newlength{\lineheight}
\setlength{\lineheight}{\heightof{A}}
\NewDocumentCommand{\Ifint}{mmm}{\IfInteger{#1}{#2}{#3}}
\newcommand{\ifint}[3]{\Ifint{#1}{#2}{#3}}
\newif\ifInTcolorbox
\newcounter{iftcbcounter}
\BeforeBeginEnvironment{tcolorbox}{%
\stepcounter{iftcbcounter}%
\InTcolorboxtrue%
\AfterEndEnvironment{tcolorbox}{%
\addtocounter{iftcbcounter}{-1}%
\ifnum\value{iftcbcounter}=0
\InTcolorboxfalse%
\fi%
\makeatletter
\newcommand{\writeansbook}[1]{}
\newcommand{\chooseNSA}{\def\kindSA{}}
\newcommand{\dotlinefull}[2][]{%
\renewcommand{\chooseNSA}{\def\kindSA{\kindSAapply}}
\AtBeginEnvironment{#2}{%
\def\colorEX{}%
\ifthenelse{\equal{\kindSA}{ShowSAKeyColor}}{\chooseNSA}{}%
\ifthenelse{\equal{\kindSA}{ShowSAKeyLG}}{\chooseNSA}{}%
\renewcommand{\TrueTF}{\FalseTF}
\renewcommand{\TrueEX}{\FalseEX}
\renewcommand{\writekeyTFone}{}
\renewcommand{\writekeyTF}{&&}
\renewcommand{\loigiai}[1]{%
\ifInTcolorbox
\ifdef{\endboxex}{\endboxex\def\endboxex{}}{}%
\fi
\setlength{\paroutindent}{\expandafter\parindent}
\setbox0=\vbox{\hbox{
\noindent\begin{minipage}{\linewidth}%
\setlength{\parindent}{\paroutindent}##1\end{minipage}
}}
\linepar=\ht0
\pgfmathparse{round((\linepar-\fboxsep)/(\lineheight))}
\par\noindent\textbf{\loigiaiEX}%
\dotlineEX{\pgfmathresult}%
\ifthenelse{\equal{#1}{ansbook}}{\writeansbook{##1}}{}%
\newlength\wsh
\newlength\hsh
\newlength\dsh
\def\dotfillans#1{\cleaders\hbox to #1{.}\hfill}
\newcommand\dotlinesh[2][.5em]{\leavevmode\hbox to #2{\dotfillans{#1}\hfil}}
\newcommand{\sh}[1]{%
\settowidth\wsh{#1}%
\settoheight\hsh{#1}%
\settodepth\dsh{#1}%
\ifdim\wsh<20pt\relax\setlength{\wsh}{20pt}\fi%
\raisebox{0pt}[\hsh][\dsh]{%
\dotlinesh{\wsh}%
\newcommand{\TF}[1]{\EXboxTF{\textbf{\colorEX#1}}}
\newcommand{\boxEX}[2][9pt]{%
\def\sizeboxEX{#1}%
\setbox1=\hbox{#2}%
\ \EXbox{#2}\ %
\newcommand{\tagEX}[1]{%
\hfill{\rm (#1)}%
\par
\@ifnextchar\begin%
{\vspace{-\baselineskip}}
{}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\newcommand{\circT}[2][red,fill=yellow!50]{\tikz[baseline=(char.base)]{\draw[#1,scale=\f@size/11.5]
(0,0) circle(7pt);\node (char)[above=-1.4ex]{\color{red}#2};\node (char)[right=6pt,scale=0.95]{\
color{black}\parbox[t]{2.6mm}{\centering Đ}};}\vspace{0.1mm}}
\newcommand{\circF}[2][red,fill=yellow!50]{\tikz[baseline=(char.base)]{\draw[#1,scale=\f@size/11.5]
(0,0) circle(7pt);\node (char)[above=-1.4ex]{\color{red}#2};\node (char)[right=6pt,scale=0.95]{\
color{black}\parbox[t]{2.6mm}{\centering S}};}\vspace{0.1mm}}
\newcommand{\circX}[2][red,fill=yellow!50]{\tikz[baseline=(char.base)]{\draw[#1,scale=\f@size/11.5]
(0,0) circle(7pt);\node (char)[above=-1.3ex]{\color{red}#2};}\vspace{0.1mm}}
\newcommand{\Onlycirc}{%
\renewcommand{\circT}[2][draw=black,fill=blue]{\,\tikz[baseline=(char.base)]{\
node[shape=circle,inner sep=0.4pt,##1] (char) {\phantom{H}};\node (0,0) {\bf\color{white}##2};}}
\renewcommand{\circF}[2][draw=black,fill=white]{\,\tikz[baseline=(char.base)]{\
node[shape=circle,inner sep=0.4pt,##1] (char) {\phantom{H}};\node (0,0) {\bf\color{black}##2};}}
\newcommand{\Fullcirc}{%
\renewcommand{\circT}[2][red,fill=yellow!40]{\tikz[baseline=(char.base)]{\draw[##1] (0,0)
circle(7pt);\node (char)[above=-1.4ex]{\color{black}##2};\node (char)[right=6pt,scale=0.95]{\
color{black}Đúng};}}
\renewcommand{\circF}[2][red,fill=yellow!40]{\tikz[baseline=(char.base)]{\draw[##1] (0,0)
circle(7pt);\node (char)[above=-1.4ex]{\color{black}##2};\node (char)[right=6pt,scale=0.95]{\
phantom{Đúng}};\node (char)[right=12pt,scale=0.95]{\color{black}Sai};}}
\newcommand{\Returncirc}{%
\renewcommand{\circT}[2][red,fill=yellow!50]{\tikz[baseline=(char.base)]{\draw[##1,scale=\
f@size/11.5] (0,0) circle(7pt);\node (char)[above=-1.4ex]{\color{red}##2};\node (char)
[right=6pt,scale=0.95]{\color{black}\parbox[t]{2.6mm}{\centering Đ}};}\vspace{0.1mm}}
\renewcommand{\circF}[2][red,fill=yellow!50]{\tikz[baseline=(char.base)]{\draw[##1,scale=\
f@size/11.5] (0,0) circle(7pt);\node (char)[above=-1.4ex]{\color{red}##2};\node (char)
[right=6pt,scale=0.95]{\color{black}\parbox[t]{2.6mm}{\centering S}};}\vspace{0.1mm}}
\newcommand{\circEX}[2][fill=yellow!50,draw=red]{%
\newcommand{\squareEX}[2][fill=yellow!50,draw=red]{%
\newcommand{\squareTF}[2][fill=yellow!50,draw=red]{%
%%==============================
\newcommand{\textchoice}{%
\ifnum\multichoice>0 \def\keyCh{\squareTF[fill=yellow!50,draw=red]{\color{red}\keyEX}}\fi
\par\noindent
\ifnum\chType=-1\selectshortans\ \keySA\fi
\ifthenelse{\equal{\qedEX}{}}{}{\dotfill\qedEX\par}%
\newcommand{\hidetextchoice}{%
\renewcommand{\textchoice}{}%
\newcommand{\showtextchoice}{%
\renewcommand{\textchoice}{%
\ifnum\multichoice>0 \def\keyCh{\squareTF[fill=yellow!50,draw=red]{\color{red}\
keyEX}}\fi
\par\noindent
\ifnum\chType=-1\selectshortans\ \keySA\fi
\ifthenelse{\equal{\qedEX}{}}{}{\dotfill\qedEX\par}%
\makeatletter
\newcommand{\listenumerate}[1]{%
\def\temp##1{%
\ifcsname ##1\endcsname
\ifcsname listened@##1\endcsname\else
\expandafter\renewcommand\csname ##1\endcsname{%
}%
\expandafter\newcommand\csname listened@##1\endcsname{}%
\fi\fi%
}%
\forcsvlist\temp{#1}%%
\AtBeginDocument{\listenumerate{ex,vd,bt}}
%Lời giải
\def\loigiaiEX{\noindent\parbox[c]{\linewidth-1mm}{\centering\color{blue}Lời giải.}}
\newcommand{\dotlineans}[3][]{%
\renewcommand{\chooseNSA}{\def\kindSA{\kindSAapply}}
\AtBeginEnvironment{#3}{%
\makeatletter
\def\colorEX{}%
\ifthenelse{\equal{\kindSA}{ShowSAKeyColor}}{\chooseNSA}{}%
\ifthenelse{\equal{\kindSA}{ShowSAKeyLG}}{\chooseNSA}{}%
\renewcommand{\TrueTF}{\FalseTF}
\renewcommand{\TrueEX}{\FalseEX}
\renewcommand{\writekeyTFone}{}
\renewcommand{\writekeyTF}{&&}
\renewcommand{\loigiai}[1]{%
\ifInTcolorbox
\ifdef{\endboxex}{\endboxex\def\endboxex{}}{}%
\fi
\par\noindent\textbf{\loigiaiEX}%
\dotlineEX{#2}%
\ifthenelse{\equal{#1}{ansbook}}{\writeansbook{##1}}{}%
\newcommand{\showansEX}[2][]{%
% \renewcommand{\chooseNSA}{\def\kindSA{ShowSAKeyColor}}
\AtBeginEnvironment{#2}{%
\makeatletter
% \chooseNSA
\showanswers
\renewcommand{\do@onlysolution}[1]{%
\par\noindent\textbf{\loigiaiEX}%
\ifshowanswers
\@ifnextchar\immini
{}
{ \@ifnextchar\begin
{}
{\par\noindent}
##1%
\fi
\ifthenelse{\equal{\keyEX}{}}{}
{\leavevmode\unskip\textchoice\ignorespaces\xdef\keyEX{}}%
\setcounter{numTrueSol}{0}%
\renewcommand{\loigiai}[1]{%
\labelex \def\labelex{}
\begin{onlysolution}
##1
\end{onlysolution}%
\ifthenelse{\equal{#1}{ansbook}}{\writeansbook{##1}}{}%
\newcommand{\exitshowansEX}[1]{%
% \renewcommand{\chooseNSA}{\def\kindSA{}}
\AtBeginEnvironment{#1}{%
\makeatletter
% \chooseNSA
\renewcommand{\loigiai}[1]{%
\writeansbook{##1}%
}%
\makeatletter
\newcommand{\hideansEX}[2][]{%
\renewcommand{\chooseNSA}{\def\kindSA{\kindSAapply}}
\AtBeginEnvironment{#2}{%
\def\colorEX{}%
\ifthenelse{\equal{\kindSA}{ShowSAKeyColor}}{\chooseNSA}{}%
\ifthenelse{\equal{\kindSA}{ShowSAKeyLG}}{\chooseNSA}{}%
\renewcommand{\TrueTF}{\FalseTF}
\renewcommand{\TrueEX}{\FalseEX}
\renewcommand{\writekeyTFone}{\gdef\TrueX{}\gdef\FalseX{}}
\renewcommand{\writekeyTF}{&&}
\renewcommand{\loigiai}[1]{%
\ifthenelse{\equal{#1}{ansbook}}{\writeansbook{##1}}{}%
\newcommand{\exithideansEX}[1]{}
\def\qedEX{\ensuremath{\square}}
\Newassociation{solshort}{Solshort}{ansshort}
\renewcommand{\Solshortlabel}[1]{\color{violet}\textbf{#1.}}
\newcommand{\shortsolnum}[1]{
\renewenvironment{Solshort}[1]
{\begin{minipage}{\linewidth/#1-1.2\fboxsep}
\color{violet}\textbf{##1.}
\color{black}
{\end{minipage}}
\newcommand{\shortsol}[1]{
\scantokens{
\begin{solshort}
#1
\end{solshort}}
\def\labelex{}
\newcommand{\nameex}{\color{violet}Câu}
\newcommand{\namebt}{\color{blue}Bài}
\newcommand{\namevd}{\color{red}Ví dụ}
\def\picinpar{\setlength{\linewidth}{\linewidth}}
\AtBeginEnvironment{window}{\def\picinpar{\setlength{\linewidth}{\linewidth-\picwd-\lwindowsep-2\
fboxsep}}}
\newcommand{\choicew}[1]{\setlength{\widthch}{#1}}
\newcommand{\loigiai}[1]{%
\begin{onlysolution}
#1
\end{onlysolution}
\newcounter{debai}
\newcounter{dapan}
\newcounter{numTrue}
\newcounter{numTrueSol}
\newcommand{\DapAnTF}{\alph{dapan}}
\newcommand{\DapAnSA}{\alph{dapan}}
\newcommand{\FalseTF}{\stepcounter{dapan}\textbf{\DapAnTF\sepTF}\ignorespaces}
\newcommand{\TrueTF}{\FalseTF}
\newcommand{\FalseEX}{\stepcounter{dapan}\textbf{\Alph{dapan}.}\ignorespaces}
\newcommand{\TrueEX}{\FalseEX}
\newcommand{\True}{\ifnum\chType=0\setcounter{numTrueSol}{\thedapan}\setcounter{numTrue}{\
thedapan}\fi}
\newlength\widthalpha
\newlength\widthalphaT
\newlength\widthalphaF
\ifnum\chType=0\settowidth\widthalphaT{\TrueEX}\else\settowidth\widthalphaT{\TrueTF}\fi
\ifnum\chType=0\settowidth\widthalphaF{\FalseEX}\else\settowidth\widthalphaF{\FalseTF}\fi
\ifdim\widthalpha<\widthalphaT\relax\setlength{\widthalpha}{\widthalphaT}\fi%
\ifdim\widthalpha<\widthalphaF\relax\setlength{\widthalpha}{\widthalphaF}\fi%
\makeatletter
\newcommand{\begindapan}{%
\@ifnextchar\True
\begin{minipage}[t]{\widthalpha}
\ifnum\chType=0\TrueEX\else\TrueTF\fi
\end{minipage}
\begin{minipage}[t]{\dorong}
\ifnum\chType=1
\xdef\saveFileAns{\saveFileAns\string\circT{\DapAnTF}}%
\ifnum\multichoice=0
\xdef\saveFileAns{\Alph{dapan}}%
\xdef\keyEX{\Alph{dapan}}%
\else
\xdef\saveFileAns{\saveFileAns\Alph{dapan}}%
\ifthenelse{\equal{\keyEX}{}}
{\xdef\keyEX{\Alph{dapan}}}
\fi
\fi%
\begin{minipage}[t]{\widthalpha}
\ifnum\chType=0\FalseEX\else\FalseTF\fi
\end{minipage}
\begin{minipage}[t]{\dorong}
\ifnum\chType=1
\xdef\saveFileAns{\saveFileAns\string\circF{\DapAnTF}}%
\fi%
\newcommand{\begindapanhaiba}{
\@ifnextchar\True
\begin{minipage}[t]{\widthalpha}
\TrueEX
\end{minipage}
\begin{minipage}[t]{0.67\dorong}
\xdef\saveFileAns{\Alph{dapan}}%
\xdef\keyEX{\Alph{dapan}}%
\begin{minipage}[t]{\widthalpha}
\FalseEX
\end{minipage}
\begin{minipage}[t]{0.67\dorong}
\newcommand{\begindapanTFt}{%
\@ifnextchar\True
\begin{minipage}[t]{\widthalpha}
\TrueTF
\end{minipage}
\begin{minipage}[t]{\dorong}
\ifnum\chType=1
\xdef\saveFileAns{\saveFileAns\string\circT{\DapAnTF}}%
\else
\xdef\saveFileAns{\Alph{dapan}}%
\xdef\keyEX{\Alph{dapan}}%
\fi%
}
\begin{minipage}[t]{\widthalpha}
\FalseTF
\end{minipage}
\begin{minipage}[t]{\dorong}
\ifnum\chType=1
\xdef\saveFileAns{\saveFileAns\string\circF{\DapAnTF}}%
\fi%
\newcommand{\boncot}[4]{%
\picinpar
\setlength{\dorong}{0.25\linewidth-0.005\dorongfix-\widthalpha-3\fboxsep}
\par\setcounter{dapan}{0}%
\ifnum\chType<1
\setcounter{numTrue}{0}%
\setcounter{numTrueSol}{0}%
\fi%
\noindent\hspace{0.02\dorongfix}\begindapan
#1\dotEX\strut
\end{minipage}
\noindent\begindapan
#2\dotEX\strut
\end{minipage}
\noindent\begindapan
#3\dotEX\strut
\end{minipage}
\noindent\begindapan
#4\dotEX\strut
\end{minipage}
%%%%
\def\parskipchoice{0cm}
\newcommand{\haicot}[4]{%
\picinpar
\setlength{\dorong}{0.5\linewidth-0.01\dorongfix-\widthalpha-3\fboxsep}
\par\setcounter{dapan}{0}%
\ifnum\chType<1
\setcounter{numTrue}{0}%
\setcounter{numTrueSol}{0}%
\fi%
\noindent\hspace{0.02\dorongfix}\begindapan
#1\dotEX\strut\ignorespaces
\end{minipage}
\noindent\begindapan
#2\dotEX\strut\ignorespaces
\end{minipage}
\par\setlength{\parskip}{\parskipchoice}
\noindent\hspace{0.02\dorongfix}\begindapan
#3\dotEX\strut\ignorespaces
\end{minipage}
\noindent\begindapan
#4\dotEX\strut\ignorespaces
\end{minipage}
\newcommand{\motcot}[4]{%
\picinpar
\setlength{\dorong}{\linewidth-0.02\dorongfix-\widthalpha-3\fboxsep}
\par
\setcounter{dapan}{0}%
\ifnum\chType<1
\setcounter{numTrue}{0}%
\setcounter{numTrueSol}{0}%
\fi%
\noindent\hspace{0.02\dorongfix}\begindapan
#1\dotEX\strut\ignorespaces
\end{minipage}
\par\setlength{\parskip}{\parskipchoice}
\noindent\hspace{0.02\dorongfix}\begindapan
#2\dotEX\strut\ignorespaces
\end{minipage}
\par\setlength{\parskip}{\parskipchoice}
\noindent\hspace{0.02\dorongfix}\begindapan
#3\dotEX\strut\ignorespaces
\end{minipage}
\par\setlength{\parskip}{\parskipchoice}
\noindent\hspace{0.02\dorongfix}\begindapan
#4\dotEX\strut\ignorespaces
\end{minipage}
}
\newlength\widthcha
\newlength\widthchb
\newlength\widthchc
\newlength\widthchd
\newlength\widthche
\newlength\widthch
\newlength\tabmaxwidth
\newlength\fourthtabwidth
\newlength\halftabwidth
\newlength\fifthtabwidth
\newlength\thirdtabwidth
\newcommand{\choice}[5][0]{%
\gdef\chType{0}\setcounter{dapan}{0}%
\let\originalcenter\center%
\let\originalendcenter\endcenter%
\renewenvironment{center}%
{\par\centering\bgroup}%
{\egroup\par}%
\setlength\tabmaxwidth{\linewidth-0.02\dorongfix-\widthalpha-3\fboxsep}
\setlength\fourthtabwidth{0.25\linewidth-0.005\dorongfix-\widthalpha-3\fboxsep}
\setlength\halftabwidth{0.5\linewidth-0.01\dorongfix-\widthalpha-3\fboxsep}
\settowidth\widthcha{#2\dotEX}
\ifdim\widthch<\widthcha\relax\setlength{\widthch}{\widthcha}\fi%
\settowidth\widthchb{#3\dotEX}%
\ifdim\widthch<\widthchb\relax\setlength{\widthch}{\widthchb}\fi%
\settowidth\widthchc{#4\dotEX}%
\ifdim\widthch<\widthchc\relax\setlength{\widthch}{\widthchc}\fi%
\settowidth\widthchd{#5\dotEX}%
\ifdim\widthch<\widthchd\relax\setlength{\widthch}{\widthchd}\fi%
\ifthenelse{\equal{#1}{0}}
\ifdim\widthch<\fourthtabwidth
\boncot{#2}{#3}{#4}{#5}
\else\ifdim\widthch<\halftabwidth
\haicot{#2}{#3}{#4}{#5}
\else
\motcot{#2}{#3}{#4}{#5}
\fi\fi
\ifthenelse{\equal{#1}{1}}
\def\parskipchoice{0.2cm}
\motcot{#2}{#3}{#4}{#5}}
\ifthenelse{\equal{#1}{2}}
\def\parskipchoice{0.2cm}
\haicot{#2}{#3}{#4}{#5}}
{
\ifthenelse{\equal{#1}{4}}
\def\parskipchoice{0.2cm}
\boncot{#2}{#3}{#4}{#5}}
\def\parskipchoice{#1}
\ifdim\widthch<\fourthtabwidth
\boncot{#2}{#3}{#4}{#5}
\else\ifdim\widthch<\halftabwidth
\haicot{#2}{#3}{#4}{#5}
\else
\motcot{#2}{#3}{#4}{#5}
\fi\fi
}}}}%
\let\center\originalcenter%
\let\endcenter\originalendcenter%
%\choicen
\makeatletter
\newcommand{\choicen}[1][1]{%
\gdef\chType{0}\picinpar%
\setcounter{dapan}{0}%
\ifint{#1}{%
\setlength{\dorong}{\linewidth/#1-0.02\dorongfix/#1-\widthalpha-3\fboxsep}
\setcounter{debai}{1}
\writerowChn[#1]}
{\Error}%
\newcommand{\writerowChn}[2][1]{%
\setlength{\parskip}{\parskipchoice}%
\ifnum\thedebai=1\par\noindent\hspace{0.02\dorongfix}\fi
\stepcounter{debai}%
\ifnum\thedebai>#1\setcounter{debai}{1}\fi%
\begindapan
#2\dotEX\strut
\end{minipage}
\@ifnextchar\bgroup{\writerowChn[#1]}{\par}
\newcommand{\nammot}[5]{%
\picinpar
\setlength{\dorong}{0.2\linewidth-0.022\dorongfix-2\fboxsep-\widthalpha}
\par\gdef\chType{0}\setcounter{dapan}{0}%
\noindent\hspace{0.02\dorongfix}\begindapan
#1\dotEX
\end{minipage}
\noindent\begindapan
#2\dotEX
\end{minipage}
\noindent\begindapan
#3\dotEX
\end{minipage}
\noindent\begindapan
#4\dotEX
\end{minipage}
\noindent\begindapan
#5\dotEX
\end{minipage}
\newcommand{\bahai}[5]{%
\picinpar\gdef\chType{0}\setcounter{dapan}{0}%
\setlength{\dorong}{0.5\linewidth-0.02\dorongfix-\fboxsep-3\widthalpha}
\par\noindent\hspace{0.02\dorongfix}\begindapanhaiba
#1\dotEX
\end{minipage}
\noindent\begindapanhaiba
#2\dotEX
\end{minipage}
\noindent\begindapanhaiba
#3\dotEX
\end{minipage}
\par\noindent\hspace{0.02\dorongfix}\begindapan
#4\dotEX
\end{minipage}
\noindent\begindapan
#5\dotEX
\end{minipage}
\newcommand{\haiba}[5]{%
\picinpar\gdef\chType{0}\setcounter{dapan}{0}%
\setlength{\dorong}{0.5\linewidth-0.02\dorongfix-\fboxsep-3\widthalpha}
\par\noindent\hspace{0.02\dorongfix}\begindapan
#1\dotEX
\end{minipage}
\noindent\begindapan
#2\dotEX
\end{minipage}
\par\noindent\hspace{0.02\dorongfix}\begindapanhaiba
#3\dotEX
\end{minipage}
\noindent\begindapanhaiba
#4\dotEX
\end{minipage}
\noindent\begindapanhaiba
#5\dotEX
\end{minipage}
\newcommand{\motnam}[5]{%
\picinpar\gdef\chType{0}\setcounter{dapan}{0}%
\setlength{\dorong}{\linewidth-0.02\dorongfix-\fboxsep-2\widthalpha}
\par
\noindent\hspace{0.02\dorongfix}\begindapan
#1\dotEX\strut
\end{minipage}
\par\noindent\hspace{0.02\dorongfix}\begindapan
#2\dotEX\strut
\end{minipage}
\par\noindent\hspace{0.02\dorongfix}\begindapan
#3\dotEX\strut
\end{minipage}
\par\noindent\hspace{0.02\dorongfix}\begindapan
#4\dotEX\strut
\end{minipage}
\par\noindent\hspace{0.02\dorongfix}\begindapan
#5\dotEX\strut
\end{minipage}
\newlength\wmothai
\newlength\wmothaiba
\newlength\wmothaibabon
\newlength\wbonnam
\newlength\wbabonnam
\newlength\whaibabonnam
\newcounter{numChoice}
\newcommand{\choicefive}[5]{%
\gdef\chType{0}\setcounter{dapan}{0}%
\setlength\tabmaxwidth{\linewidth-\picwd-\lwindowsep}
\setlength\fourthtabwidth{0.25\linewidth-0.25\picwd-0.25\lwindowsep-\widthalpha}
\setlength\halftabwidth{0.5\linewidth-0.5\picwd-0.5\lwindowsep-\widthalpha}
\setlength\fifthtabwidth{0.2\linewidth-0.2\picwd-0.2\lwindowsep-\widthalpha}
\setlength\thirdtabwidth{0.33\linewidth-0.33\picwd-0.33\lwindowsep-\widthalpha}
\settowidth\widthcha{AM.#1}
\ifdim\widthch<\widthcha\relax\setlength{\widthch}{\widthcha}\fi%
\ifdim\wmothai<\widthcha\relax\setlength{\wmothai}{\widthcha}\fi%
\ifdim\wmothaiba<\widthcha\relax\setlength{\wmothaiba}{\widthcha}\fi%
\ifdim\wmothaibabon<\widthcha\relax\setlength{\wmothaibabon}{\widthcha}\fi%
\settowidth\widthchb{BM.#2}%
\ifdim\widthch<\widthchb\relax\setlength{\widthch}{\widthchb}\fi%
\ifdim\wmothai<\widthchb\relax\setlength{\wmothai}{\widthchb}\fi%
\ifdim\wmothaiba<\widthchb\relax\setlength{\wmothaiba}{\widthchb}\fi%
\ifdim\wmothaibabon<\widthchb\relax\setlength{\wmothaibabon}{\widthchb}
\fi%
\ifdim\whaibabonnam<\widthchb\relax\setlength{\whaibabonnam}{\widthchb}
\fi%
\settowidth\widthchc{CM.#3}%
\ifdim\widthch<\widthchc\relax\setlength{\widthch}{\widthchc}\fi%
\ifdim\wmothaiba<\widthchc\relax\setlength{\wmothaiba}{\widthchc}\fi%
\ifdim\wmothaibabon<\widthchc\relax\setlength{\wmothaibabon}{\widthchc}\fi%
\ifdim\wbabonnam<\widthchc\relax\setlength{\wbabonnam}{\widthchc}\fi%
\ifdim\whaibabonnam<\widthchc\relax\setlength{\whaibabonnam}{\widthchc}
\fi%
\settowidth\widthchd{DM.#4}%
\ifdim\widthch<\widthchd\relax\setlength{\widthch}{\widthchd}\fi%
\ifdim\wmothaibabon<\widthchd\relax\setlength{\wmothaibabon}{\widthchd}\fi%
\ifdim\wbabonnam<\widthchd\relax\setlength{\wbabonnam}{\widthchd}\fi%
\ifdim\wbonnam<\widthchd\relax\setlength{\wbonnam}{\widthchd}\fi%
\ifdim\whaibabonnam<\widthchd\relax\setlength{\whaibabonnam}{\widthchd}
\fi%
\settowidth\widthche{EM.#5}%
\ifdim\widthch<\widthche\relax\setlength{\widthch}{\widthche}\fi%
\ifdim\wbabonnam<\widthche\relax\setlength{\wbabonnam}{\widthche}\fi%
\ifdim\wbonnam<\widthche\relax\setlength{\wbonnam}{\widthche}\fi%
\ifdim\whaibabonnam<\widthchd\relax\setlength{\whaibabonnam}{\widthchd}
\fi%
\setcounter{numChoice}{0}
\ifdim\wmothai<\halftabwidth
\ifdim\wbabonnam<\thirdtabwidth
\setcounter{numChoice}{1}
\fi\fi
\ifdim\wmothaiba<\thirdtabwidth
\ifdim\wbonnam<\halftabwidth
\setcounter{numChoice}{2}
\fi\fi
\ifdim\widthch<\fifthtabwidth
\setcounter{numChoice}{3}
\fi
\ifnum\the\value{numChoice}=3
\nammot{#1}{#2}{#3}{#4}{#5}
\else
\ifnum\the\value{numChoice}=2
\bahai{#1}{#2}{#3}{#4}{#5}
\else
\ifnum\the\value{numChoice}=1
\haiba{#1}{#2}{#3}{#4}{#5}
\else
\motnam{#1}{#2}{#3}{#4}{#5}
\fi\fi\fi
}
%\choiceTF
\def\tickT{X} % Chỗ này dùng để định nghĩa dấu tick đúng hoặc sai
\def\tickF{X}
\gdef\TrueX{}\gdef\FalseX{\tickF}
\newlength{\tabcolsep}
\let\TabCOLSEP\tabcolsep
\setlength{\TabCOLSEP}{1.5mm}
\newtoggle{InMulticols}\togglefalse{InMulticols}
\AtBeginEnvironment{multicols}{\toggletrue{InMulticols}}
\AtEndEnvironment{multicols}{\togglefalse{InMulticols}}
\newtoggle{InParacol}\togglefalse{InParacol}
\AtBeginEnvironment{paracol}{\toggletrue{InParacol}}
\AtEndEnvironment{paracol}{\togglefalse{InParacol}}
\makeatletter
\newlength\lengthDS
\newcommand{\boldTF}{\bf}
\define@key{optn}{dapanTF}{\def\dapanTF{#1}}
\define@key{optn}{kindTF}{\def\kindTF{#1}%
\ifthenelse{\equal{#1}{t0}}{\def\kindTF{t}\def\cotDS{0}}{}%
\define@key{optn}{boldTF}{%
\ifthenelse{\equal{#1}{0}}
{\renewcommand{\boldTF}{}}
{\renewcommand{\boldTF}{\bf}}%
}
\define@key{optn}{phatbieu}{\def\phatbieu{#1}}
\define@key{optn}{viettat}{\def\viettat{#1}}
\define@key{optn}{sepTF}{\def\sepTF{#1}}% dấu ngăn cách cho abcd với phát biểu Đ/S
\newcommand{\TFOPTN}[1]{%
\setkeys{optn}{#1}%
\ifthenelse{\equal{\viettat}{0}}
{\def\Dung{Đúng}\def\Sai{Sai}\setlength{\lengthDS}{11mm}}
{\def\Dung{Đ}\def\Sai{S}\setlength{\lengthDS}{5.5mm}}%
\IfSubStr{#1}{sepTF}{%
\ifthenelse{\equal{\dapanTF}{A}}
{\renewcommand{\DapAnTF}{\Alph{dapan}}}
{\ifthenelse{\equal{\dapanTF}{1}}
{\renewcommand{\DapAnTF}{\arabic{dapan}}}
{\renewcommand{\DapAnTF}{\alph{dapan}}}}%
}{%
\ifthenelse{\equal{\dapanTF}{A}}
{\renewcommand{\DapAnTF}{\Alph{dapan}}\def\sepTF{.}}
{\ifthenelse{\equal{\dapanTF}{1}}
{\renewcommand{\DapAnTF}{\arabic{dapan}}\def\sepTF{)}}
{\renewcommand{\DapAnTF}{\alph{dapan}}\def\sepTF{)}}}%
\TFOPTN{kindTF=,dapanTF=a,cotDS=1,boldTF=1,phatbieu=Phát biểu,viettat=1}
\makeatletter
\newcommand{\callcotDS}{}
\newcommand{\choiceTF}[5][0cm]{%
\gdef\chType{1}\callcotDS%
%Tương thích môi trường {center}
\let\originalcenter\center%
\let\originalendcenter\endcenter%
\xdef\sdotEX{\dotEX}
\renewenvironment{center}%
{\xdef\dotEX{}%
\par\centering\bgroup}%
{\egroup\par}%
\ifthenelse{\equal{\kindTF}{0}}
{\choiceTFfix[#1]{#2}{#3}{#4}{#5}}
{\ifthenelse{\equal{\kindTF}{1t}}
{\motbang{#2}{#3}{#4}{#5}}
{\haibang{#2}{#3}{#4}{#5}}
{\ifthenelse{\equal{\kindTF}{t}}
{\settowidth\widthcha{#2\dotEX}%
\ifdim\widthch<\widthcha\relax\setlength{\widthch}{\widthcha}\fi%
\settowidth\widthchb{#3\dotEX}%
\ifdim\widthch<\widthchb\relax\setlength{\widthch}{\widthchb}\fi%
\settowidth\widthchc{#4\dotEX}%
\ifdim\widthch<\widthchc\relax\setlength{\widthch}{\widthchc}\fi%
\settowidth\widthchd{#5\dotEX}%
\ifdim\widthch<\widthchd\relax\setlength{\widthch}{\widthchd}\fi%
\ifnum\cotDS=1%
\setlength\halftabwidth{0.5\linewidth-\widthalpha-6\tabcolsep-15mm-2\fboxsep}
\else%
\setlength\halftabwidth{0.5\linewidth-\widthalpha-2\tabcolsep-7mm-0\fboxsep}
\fi%
\ifdim\widthch<\halftabwidth
\haibang{#2}{#3}{#4}{#5}
\else \motbang{#2}{#3}{#4}{#5}
\fi}
{\ifthenelse{\equal{#1}{t}}
{\settowidth\widthcha{#2\dotEX}%
\ifdim\widthch<\widthcha\relax\setlength{\widthch}{\widthcha}\fi%
\settowidth\widthchb{#3\dotEX}%
\ifdim\widthch<\widthchb\relax\setlength{\widthch}{\widthchb}\fi%
\settowidth\widthchc{#4\dotEX}%
\ifdim\widthch<\widthchc\relax\setlength{\widthch}{\widthchc}\fi%
\settowidth\widthchd{#5\dotEX}%
\ifdim\widthch<\widthchd\relax\setlength{\widthch}{\widthchd}\fi%
\ifnum\cotDS=1%
\setlength\halftabwidth{0.5\linewidth-\widthalpha-6\tabcolsep-15mm-2\fboxsep}
\else%
\setlength\halftabwidth{0.5\linewidth-\widthalpha-2\tabcolsep-7mm-0\fboxsep}
\fi%
\ifdim\widthch<\halftabwidth
\haibang{#2}{#3}{#4}{#5}
\else \motbang{#2}{#3}{#4}{#5}
\fi}
{\ifthenelse{\equal{#1}{1t}}
{\motbang{#2}{#3}{#4}{#5}}
{\haibang{#2}{#3}{#4}{#5}}
{\choiceTFfix[#1]{#2}{#3}{#4}{#5}}}}}}}}%\medskip%
%Trả lại định nghĩa gốc môi trường {center}
\let\center\originalcenter%
\let\endcenter\originalendcenter%
\newcommand{\ifInMulticol}[2]{%
\iftoggle{InMulticols}{#1}{%
\iftoggle{InParacol}{#1}{#2}}%
\newcommand{\writerowTF}[1]{%
\hline\rule[0pt]{0pt}{14pt}%
\xdef\dotEX{\sdotEX}%
\ifnum\cotDS=1%
\noindent\hspace{-1.3mm}\begindapanTFt%
#1\dotEX\strut%
\end{minipage}\vspace{1pt}%
\writekeyTF\\
\else%
\noindent\hspace{-1.3mm}\begindapanTFt%
#1\dotEX\strut%
\end{minipage}\vspace{1pt}%
\\
\fi%
\newcommand{\writekeyTFone}{\gdef\TrueX{}\gdef\FalseX{}}
\newcommand{\writekeyTF}{&&}
\newcommand{\STF}{{\bf\large\color{red}
Lệnh này giờ vô dụng vì đã có lệnh khác linh hoạt hơn.\\\noindent Hãy đổi lệnh lại thành {\
color{blue}\string\TFOPTN\{kindTF=0\}}
}}
\newcommand{\standardchoiceTF}{{\bf\large\color{red}
Lệnh này giờ vô dụng vì đã có lệnh khác linh hoạt hơn.\\\noindent Hãy đổi lệnh lại thành {\
color{blue}\string\TFOPTN\{kindTF=0\}}
}}
\newcommand{\choiceTFfix}[5][0cm]{%
\gdef\chType{1}%
\setlength\tabmaxwidth{\linewidth-0.02\dorongfix-\widthalpha-3\fboxsep}
\setlength\fourthtabwidth{0.25\linewidth-0.02\dorongfix-\widthalpha-3\fboxsep}
\setlength\halftabwidth{0.5\linewidth-0.02\dorongfix-\widthalpha-3\fboxsep}
\settowidth\widthcha{#2\dotEX}%
\ifdim\widthch<\widthcha\relax\setlength{\widthch}{\widthcha}\fi%
\settowidth\widthchb{#3\dotEX}%
\ifdim\widthch<\widthchb\relax\setlength{\widthch}{\widthchb}\fi%
\settowidth\widthchc{#4\dotEX}%
\ifdim\widthch<\widthchc\relax\setlength{\widthch}{\widthchc}\fi%
\settowidth\widthchd{#5\dotEX}%
\ifdim\widthch<\widthchd\relax\setlength{\widthch}{\widthchd}\fi%
\def\parskipchoice{0.1cm}
\ifthenelse{\equal{#1}{1}}
{\motcot{#2}{#3}{#4}{#5}}
{\ifthenelse{\equal{#1}{2}}
{\haicot{#2}{#3}{#4}{#5}}
{\ifthenelse{\equal{#1}{4}}
{\boncot{#2}{#3}{#4}{#5}}
{\ifthenelse{\equal{#1}{t} \OR \equal{#1}{1t} \OR \equal{#1}{2t} \OR \equal{#1}{tt} \OR \
equal{#1}{} \OR \equal{#1}{0}}{}
{\def\parskipchoice{#1}}
\ifdim\widthch<\fourthtabwidth
\boncot{#2}{#3}{#4}{#5}
\else\ifdim\widthch<\halftabwidth
\haicot{#2}{#3}{#4}{#5}
\else\motcot{#2}{#3}{#4}{#5}
\fi\fi}}}
\newcommand{\motbang}[4]{%
\gdef\TrueX{}\gdef\FalseX{}%
\ifnum\cotDS=1%
\setlength{\dorong}{\linewidth-\widthalpha-6\tabcolsep-2\lengthDS-7mm-2\fboxsep}%
\else%
\setlength{\dorong}{\linewidth-\widthalpha-2\tabcolsep-7mm-2\fboxsep}%
\fi%
\ifInMulticol
{\par\medskip\hfill\xentrystretch{-0.15}%
\ifnum\cotDS=1%
\begin{xtabular}{|m{\linewidth-6\tabcolsep-2\lengthDS-7mm}|m{\lengthDS}|
m{\lengthDS}|}
\else%
\begin{xtabular}{|m{\linewidth-2\tabcolsep-7mm}|}
\fi}
{\ifnum\cotDS=1%
\begin{longtable}{|m{\linewidth-6\tabcolsep-2\lengthDS-7mm}|m{\lengthDS}|m{\
lengthDS}|}
\else%
\begin{longtable}{|m{\linewidth-2\tabcolsep-7mm}|}
\fi}
\ifnum\cotDS=1%
\else%
\hline\centering{\boldTF\phatbieu} \tabularnewline%
\fi
\ifInMulticol{}{\endhead}%
\writerowTF{#1}
\writerowTF{#2}
\writerowTF{#3}
\writerowTF{#4}
\hline
\ifInMulticol
{\end{xtabular}\par}
{\end{longtable}\vspace{-\baselineskip}}
\medskip%
\newcommand{\haibang}[4]{%
\ifInMulticol
{{\bf\large\color{red}Trong môi trường chia cột, tùy chọn tách đôi bảng của \string\choiceTF
không hoạt động. Bạn kiểm tra lại nhé!}}
{\gdef\TrueX{}\gdef\FalseX{}%
\ifnum\cotDS=1%
\setlength{\dorong}{0.5\linewidth-\widthalpha-6\tabcolsep-2\lengthDS-7mm-
2\fboxsep}%
\else%
\setlength{\dorong}{0.5\linewidth-\widthalpha-2\tabcolsep-7mm-2\fboxsep}%
\fi%
\par\noindent
\begin{minipage}[t][][b]{0.5\textwidth}
\vspace{-\baselineskip}
\ifnum\cotDS=1%
\begin{longtable}{|m{\linewidth-6\tabcolsep-2\lengthDS-7mm}|m{\
lengthDS}|m{\lengthDS}|}
\else%
\begin{longtable}{|m{\linewidth-2\tabcolsep-7mm}|}
\hline\centering{\boldTF\phatbieu}\tabularnewline
\fi%
\ifInMulticol{}{\endhead}%
\writerowTF{#1}
\writerowTF{#2}
\hline
\end{longtable}\vspace{-\baselineskip}
\end{minipage}
\begin{minipage}[t][][b]{0.5\textwidth}
\vspace{-\baselineskip}
\ifnum\cotDS=1%
\begin{longtable}{|m{\linewidth-6\tabcolsep-2\lengthDS-7mm}|m{\
lengthDS}|m{\lengthDS}|}
\else%
\begin{longtable}{|m{\linewidth-2\tabcolsep-7mm}|}
\hline\centering{\boldTF\phatbieu}\tabularnewline
\fi%
\ifInMulticol{}{\endhead}%
\writerowTF{#3}
\writerowTF{#4}
\hline
\end{longtable}\vspace{-\baselineskip}
\end{minipage}
\par\medskip}%
%\choiceTFn
\makeatletter
\newcommand{\choiceTFn}[1][1]{%
\gdef\chType{1}\picinpar
\setcounter{dapan}{0}
\ifint{#1}{%
\setlength{\dorong}{\linewidth/#1-0.02\dorongfix-\widthalpha-3.5\fboxsep}
\setcounter{debai}{1}
\writerowTFn[#1]}
{\Error}%
\newcommand{\Error}[2][]{%
\@ifnextchar\bgroup{\Error}{%
\newcommand{\writerowTFn}[2][1]{%
\setlength{\parskip}{\parskipchoice}
\ifnum\thedebai=1\par\noindent\fi%
\stepcounter{debai}%
\ifnum\thedebai>#1\setcounter{debai}{1}\fi%
\hspace{0.02\dorongfix}\begindapan%
#2\dotEX\strut%
\end{minipage}%
\@ifnextchar\bgroup{\writerowTFn[#1]}{\par}
%\choiceTFt
\makeatletter
\newcommand{\choiceTFt}[1][]{%
\gdef\chType{1}%
\gdef\TrueX{}\gdef\FalseX{}%
\setlength{\dorong}{\linewidth-\widthalpha-6\TabCOLSEP-2\lengthDS-5.8mm-2\fboxsep}%
\ifthenelse{\equal{#1}{}}{}{\renewcommand{\arraystretch}{#1}}%
\ifInMulticol
{\par\medskip\hfill\xentrystretch{-0.15}%
\begin{xtabular}{|m{\linewidth-2\lengthDS-15mm}|m{\lengthDS}|m{\lengthDS}|}}
{\begin{longtable}{|m{\linewidth-2\lengthDS-15mm}|m{\lengthDS}|m{\lengthDS}|}}
\ifInMulticol{}{\endhead}%
\writerowTFt
\newcommand{\writerowTFt}[1]{%
\hline\rule[0pt]{0pt}{14pt}%
\noindent\hspace{-1.3mm}\begindapanTFt
#1\dotEX\strut%
\end{minipage}\vspace{1pt}
\writekeyTF
\@ifnextchar\bgroup{\tabularnewline\writerowTFt}{\tabularnewline\hline%
\ifInMulticol
{\end{xtabular}\par}%
{\end{longtable}\vspace{-\baselineskip}}%
\medskip}
%\shortans
\makeatletter
\define@key{optn}{ketquaSA}{\def\ketqua{#1}\def\ketquaSA{\ketqua}}
\define@key{optn}{widthSA} {\def\SAwidth{#1}\def\widthSA{\SAwidth}}
\define@key{optn}{heightSA}{\def\SAheight{#1}\def\heightSA{\SAheight}}
\define@key{optn}{dapanSA}{\def\dapanSA{#1}}
\newcommand{\SAOPTN}[1]{%
\setkeys{optn}{#1}%
\renewcommand{\chooseNSA}{\xdef\kindSA{\kindSAapply}}
\ifthenelse{\equal{\dapanSA}{A}}
{\renewcommand{\DapAnSA}{\Alph{dapan}}}
{\ifthenelse{\equal{\dapanSA}{1}}
{\renewcommand{\DapAnSA}{\arabic{dapan}}}
{\renewcommand{\DapAnSA}{\alph{dapan}}}}%
\SAOPTN{kindSA=,ketquaSA=KQ:,widthSA=4,heightSA=0.9,dapanSA=a}
\makeatletter
% Command to clean the string
\newcommand{\cleanstring}[1]{%
% \StrSubstitute{\cleaned}{$}{}[\cleaned]%
\newcommand{\isvalidstring}[1]{%
\StrSubstitute{\temp}{1}{}[\temp]%
\StrSubstitute{\temp}{2}{}[\temp]%
\StrSubstitute{\temp}{3}{}[\temp]%
\StrSubstitute{\temp}{4}{}[\temp]%
\StrSubstitute{\temp}{5}{}[\temp]%
\StrSubstitute{\temp}{6}{}[\temp]%
\StrSubstitute{\temp}{7}{}[\temp]%
\StrSubstitute{\temp}{8}{}[\temp]%
\StrSubstitute{\temp}{9}{}[\temp]%
\newif\ifvalid
\validfalse
\newcommand{\TachO}[1]{%
\isvalidstring{#1}%
\ifvalid%
\cleanstring{#1}% Clean the input string
\ifnum\length<5%
\begin{tabular}{|m{2.5mm}|m{2.5mm}|m{2.5mm}|m{2.5mm}|}
\hline%
\ifnum\length>0 \StrChar{\cleaned}{1}[\firstchar]\centering $\
firstchar$ \fi &%
\ifnum\length>1 \StrChar{\cleaned}{2}[\secondchar]\centering
$\secondchar$ \fi &%
\ifnum\length>2 \StrChar{\cleaned}{3}[\thirdchar]\centering $\
thirdchar$ \fi &%
\ifnum\length>3 \StrChar{\cleaned}{4}[\fourthchar]\centering
$\fourthchar$ \fi \tabularnewline%
\hline%
\end{tabular}%
\else #1 \fi%
\else #1 \fi%
\makeatletter
\newcommand{\SA}[2][]{\shortans[#1]{#2}}
\newcommand{\ifInList}[2]{\ifnumgreater{\@listdepth}{0}{#1}{#2}}
\newcommand{\oKQ}[2][]{%
\ifthenelse{\equal{#1}{}}
{\raisebox{0pt}{\tikz[baseline=(char.base)]{\node (char)[left]{\ketquaSA};
{\ifthenelse{\equal{#1}{oly}}
{\raisebox{0pt}{\tikz[baseline=(char.base)]{\node (char)[left]{\ketquaSA};
{\raisebox{0pt}{\tikz[baseline=(char.base)]{\node (char)[left]{\
ketquaSA};
\node (char)[right,yshift=-2]{\ldots\ldots\ldots\ldots\ldots\
ldots\ldots\ldots};}}}
{}}}%
\newcommand{\shortans}[2][]{%
\gdef\chType{-1}%
\ifthenelse{\equal{\kindSA}{}}
{\shortansfix[#1]{\TachO{#2}}}
{\ifthenelse{\equal{\kindSA}{ShowSAKeyColor}}
{\hfill\raisebox{0pt}{\tikz[baseline=(char.base)]{%
\ifInList{\hspace{-2mm}}{\par}}
{\ifthenelse{\equal{\kindSA}{ShowSAKeyLG}}
{\hfill\raisebox{0pt}{\tikz[baseline=(char.base)]{%
\ifInList{\hspace{-2mm}}{\par}}
{\shortansfix[\kindSA]{\TachO{#2}}}%
}%
}%
\ifInList
{\xdef\saveFileAns{\detokenize{\TachO{#2}}}}%
}
\newcommand{\shortansfix}[2][]{%
\ifthenelse{\equal{#1}{0}}{}
{\ifthenelse{\equal{#1}{}}
{\hfill\oKQ{\widthSA}}
{\ifthenelse{\equal{#1}{oly}}
{\hfill\oKQ[oly]{4}}
{\ifthenelse{\equal{#1}{...}}
{\hfill\oKQ[...]{\widthSA}}
{\hfill\oKQ{#1}}}}%
\ifInList{\hspace{-1mm}}{\par}%
}%
\newcommand{\SSA}{\standardshortans}
\newcommand{\hideshortans}{\standardshortans}
\newcommand{\hideSA}{\standardshortans}
\newcommand{\standardshortans}{{\bf\large\color{red}
Lệnh này giờ vô dụng vì đã có lệnh khác linh hoạt hơn.\\\noindent Hãy đổi lệnh lại thành {\
color{blue}\string\SAOPTN\{kindSA=0\}}
}}
\newcommand{\NSA}{\normalshortans}
\newcommand{\normalshortans}{{\bf\large\color{red}
Lệnh này giờ vô dụng vì đã có lệnh khác linh hoạt hơn.\\\noindent Hãy đổi lệnh lại thành {\
color{blue}\string\SAOPTN\{kindSA=\}}
}}
\makeatletter
\newenvironment{itemchoice}[1][]
\let\itemch\item\let\item\Eitem%
\ifthenelse{\equal{#1}{}}
{\ifnum\chType=1
\ifthenelse{\equal{\dapanTF}{1}}
{\begin{enumerate}[\bf 1\sepTF]}
{\ifthenelse{\equal{\dapanTF}{A}}
{\begin{enumerate}[\bf A\sepTF]}
{\begin{enumerate}[\bf a\sepTF]}}
\else\begin{enumerate}[\bf A.]\fi}
{\begin{enumerate}[\bf#1]}
\delError{itemize,enumerate,enumEX,listEX,center}%
{\AtBeginEnvironment{enumerate}{\let\itemch\item\let\item\Eitem}%
\end{enumerate}%
\AtBeginEnvironment{enumerate}{\let\Eitem\item}
\let\itemT\item
\newcommand{\delError}[1]{%
\AtBeginEnvironment{\xEnvN}{%
\let\item\itemT\let\itemch\Esubitemch%
}
}
\newcommand{\finditemchoice}{%
\renewenvironment{itemchoice}[1][]{%
\newcommand{\Eitem}{\itemch[\Large\bf\circEX{item}]}%
\newcommand{\Esubitemch}{\item[\large\bf\circEX{itemch}]}%
\let\itemch\item\let\item\Eitem%
\setlist[enumerate,1]{label=\bf\large\color{blue}itemch}
\begin{enumerate}
\delError{itemize,enumerate,enumEX,listEX,center}%
}{\AtBeginEnvironment{enumerate}{\let\itemch\item\let\item\Eitem}%
\end{enumerate}}
%%=====================================
\makeatletter
\newcommand{\defboxex}[1][]{
\ifthenelse{\equal{#1}{ex}}{\def\boxexcl{green!10}}{\def\boxexcl{yellow!10}}
\def\endboxex{\end{tcolorbox}}
\makeatletter
\@ifpackageloaded{tcolorbox}{%
\newcommand{\createbox}[1]{%
\AtBeginEnvironment{#1}{%
\defboxex[#1]%
\refstepcounter{#1}
\renewcommand{\Currentlabel}{\@currentlabel}%
\addtocounter{#1}{-1}%
\gdef\chType{0}\gdef\saveFileAns{}\gdef\keyEX{}%
\setcounter{dapan}{0}%
\setcounter{numTrueSol}{0}%
\setcounter{numChoice}{0}%
\beginboxex%
\AtEndEnvironment{#1}{\endboxex\def\endboxex{}}
}%
}{%
\newcommand{\createbox}[1]{{\noindent\bf\large\color{red}
\begin{itemize}
\item Gói lệnh {\color{blue}tcolorbox} cần được khai báo trước khi khai báo gói
ex-test.
\item Hãy tắt lệnh {\color{blue}\string\createbox\{\}} đi nếu bạn thấy không cần
thiết.
\end{itemize}
}}%
%%=====================================
\DeclareOption{solcolor}{
\renewcommand{\TF}[1]{\EXboxTF{\textbf{\colorEX#1}}}
\renewcommand{\boxEX}[2][9pt]{%
\setbox1=\hbox{#2}%
\def\sizeboxEX{#1}%
\ \EXbox{#2}\ %
\renewcommand{\sh}[1]{\text{#1}}
\makeatletter
\def\colorEX{\color{red}}
\renewcommand{\TrueTF} {\stepcounter{dapan}\squareEX{\bf\DapAnTF}\ignorespaces}
\renewcommand{\TrueEX} {\stepcounter{dapan}\squareEX{\bf\Alph{dapan}}\ignorespaces}
\renewcommand{\True}{%
\ifnum\chType=0\setcounter{numTrue}{\thedapan}\setcounter{numTrueSol}{\
thedapan}%
\leavevmode\colorEX%
%\choiceTF
\renewcommand{\callcotDS}{\def\cotDS{1}}%
\renewcommand{\writekeyTFone}{\gdef\TrueX{}\gdef\FalseX{\tickF}}
\renewcommand{\writekeyTF}{%
&\vspace{-1pt}\centering\leavevmode\TrueX%
&\vspace{-3pt}\parbox[t]{\linewidth}{\centering\leavevmode\FalseX}%
\gdef\TrueX{}\gdef\FalseX{\tickF}%
%\shortans
\def\kindSA{ShowSAKeyColor}
\showanswers
\renewcommand{\do@onlysolution}[1]{%
\par\noindent\textbf{\loigiaiEX}%
\ifshowanswers
\@ifnextchar\immini
{}
{ \@ifnextchar\begin
{}
{\par\noindent}
#1%
\fi
\ifthenelse{\equal{\keyEX}{}}{}
{\leavevmode\unskip\textchoice\ignorespaces\xdef\keyEX{}}%
\setcounter{numTrueSol}{0}%
\renewcommand{\loigiai}[1]{
\labelex
\def\labelex{}
\begin{onlysolution}
#1
\end{onlysolution}
\renewcommand{\exitshowansEX}[1]{}
\renewcommand{\exithideansEX}[1]{%
\makeatletter
\AtBeginEnvironment{#1}{%
\def\kindSA{ShowSAKeyColor}%
\def\colorEX{\color{red}}%
\renewcommand{\TrueTF} {\stepcounter{dapan}\squareEX{\bf\DapAnTF}\
ignorespaces}
\renewcommand{\TrueEX} {\stepcounter{dapan}\squareEX{\bf\Alph{dapan}}\
ignorespaces}
\renewcommand{\writekeyTFone}{\gdef\TrueX{}\gdef\FalseX{\tickF}}
\renewcommand{\writekeyTF}{%
&\vspace{-1pt}\centering\leavevmode\TrueX%
&\vspace{-3pt}\parbox[t]{\linewidth}{\centering\leavevmode\FalseX}%
\gdef\TrueX{}\gdef\FalseX{\tickF}%
\renewcommand{\loigiai}[1]{%
\labelex
\def\labelex{}
\begin{onlysolution}
##1
\end{onlysolution}
%%=====================================
\DeclareOption{loigiai}{
\makeatletter
\renewcommand{\TF}[1]{\EXboxTF{\textbf{\colorEX#1}}}
\renewcommand{\boxEX}[2][9pt]{%
\setbox1=\hbox{#2}%
\def\sizeboxEX{#1}%
\ \EXbox{#2}\ %
\renewcommand{\sh}[1]{\text{#1}}
\showanswers
\makeatletter
\renewcommand{\do@onlysolution}[1]{%
\par\noindent\textbf{\loigiaiEX}%
\ifshowanswers
\@ifnextchar\immini
{}
{ \@ifnextchar\begin
{}
{\par\noindent}
#1%
\fi
\ifthenelse{\equal{\keyEX}{}}{}
{\leavevmode\unskip\textchoice\ignorespaces\xdef\keyEX{}}%
\setcounter{numTrueSol}{0}%
\renewcommand{\loigiai}[1]{
\labelex
\def\labelex{}
\begin{onlysolution}
#1
\end{onlysolution}
\renewcommand{\True}{%
\ifnum\chType=0\setcounter{numTrue}{\thedapan}\setcounter{numTrueSol}{\
thedapan}%
\else \gdef\TrueX{\tickT}\gdef\FalseX{}\fi%
%\choiceTF
\renewcommand{\callcotDS}{\def\cotDS{1}}%
\renewcommand{\writekeyTFone}{\gdef\TrueX{}\gdef\FalseX{\tickF}}
\renewcommand{\writekeyTF}{%
&\vspace{-1pt}\centering\leavevmode\TrueX%
&\vspace{-3pt}\parbox[t]{\linewidth}{\centering\leavevmode\FalseX}%
\gdef\TrueX{}\gdef\FalseX{\tickF}%
%\shortans
\def\kindSA{ShowSAKeyLG}
\renewcommand{\exitshowansEX}[1]{}
\renewcommand{\exithideansEX}[1]{%
\makeatletter
\AtBeginEnvironment{#1}{%
\def\kindSA{ShowSAKeyLG}%
\renewcommand{\writekeyTFone}{\gdef\TrueX{}\gdef\FalseX{\tickF}}
\renewcommand{\writekeyTF}{%
&\vspace{-1pt}\centering\leavevmode\TrueX%
&\vspace{-3pt}\parbox[t]{\linewidth}{\centering\leavevmode\FalseX}%
\gdef\TrueX{}\gdef\FalseX{\tickF}%
}
\renewcommand{\loigiai}[1]{%
\labelex
\def\labelex{}
\begin{onlysolution}
##1
\end{onlysolution}
%%=====================================
\DeclareOption{color}{
\makeatletter
\def\colorEX{\color{red}}
\renewcommand{\TrueTF} {\stepcounter{dapan}\squareEX{\bf\DapAnTF}\ignorespaces}
\renewcommand{\TrueEX} {\stepcounter{dapan}\squareEX{\bf\Alph{dapan}}\ignorespaces}
\renewcommand{\True}{%
\ifnum\chType=0\setcounter{numTrue}{\thedapan}\setcounter{numTrueSol}{\
thedapan}%
\leavevmode\colorEX%
%\choiceTF
\renewcommand{\callcotDS}{\def\cotDS{1}}%
\renewcommand{\writekeyTFone}{\gdef\TrueX{}\gdef\FalseX{\tickF}}
\renewcommand{\writekeyTF}{%
&\vspace{-1pt}\centering\leavevmode\TrueX%
&\vspace{-3pt}\parbox[t]{\linewidth}{\centering\leavevmode\FalseX}%
\gdef\TrueX{}\gdef\FalseX{\tickF}%
%\shortans
\def\kindSA{ShowSAKeyColor}
\renewcommand{\exithideansEX}[1]{%
\makeatletter
\AtBeginEnvironment{#1}{%
\def\kindSA{ShowSAKeyColor}%
\def\colorEX{\color{red}}%
\renewcommand{\TrueTF} {\stepcounter{dapan}\squareEX{\bf\DapAnTF}\
ignorespaces}
\renewcommand{\TrueEX} {\stepcounter{dapan}\squareEX{\bf\Alph{dapan}}\
ignorespaces}
\renewcommand{\writekeyTFone}{\gdef\TrueX{}\gdef\FalseX{\tickF}}
\renewcommand{\writekeyTF}{%
&\vspace{-1pt}\centering\leavevmode\TrueX%
&\vspace{-3pt}\parbox[t]{\linewidth}{\centering\leavevmode\FalseX}%
\gdef\TrueX{}\gdef\FalseX{\tickF}%
%%=====================================
\DeclareOption{book}{
\makeatletter
\showanswers
\renewcommand{\loigiai}[1]{%
\labelex \def\labelex{}
\writeansbook{#1}%
\renewcommand{\writeansbook}[1]{%
\Writetofile{ansbook}{\string\begin{Solbook}{\Currentlabel}}%
\Writetofile{ansbook}{\string\def\string\chType\string{\chType\string}}%
\ifthenelse{\equal{\saveFileAns}{}}{}{%
\ifnum\chType=0
\ifnum\the\value{numTrueSol}>0
\Writetofile{ansbook}{\detokenize{\selectchoice}\ \string\
circEX{\saveFileAns}}%
\fi
\else\ifnum\chType=1
\Writetofile{ansbook}{\detokenize{\selectchoiceTF}: \saveFileAns}%
\else
\Writetofile{ansbook}{\detokenize{\selectshortans}\ \saveFileAns}%
\fi\fi%
}%
\Writetofile{ansbook}{\string\par\string\noindent^^J\detokenize{#1}^^J\string\par\
string\noindent}%
\Writetofile{ansbook}{\string\end{Solbook}}%
\setcounter{numTrueSol}{0}%
}
\renewcommand{\exithideansEX}[1]{%
\AtBeginEnvironment{#1}{%
\renewcommand{\loigiai}[1]{%
\labelex \def\labelex{}
\writeansbook{##1}%
}%
}%
%%=====================================
\DeclareOption{dethi}{
\makeatletter
\renewcommand{\TF}[1]{\EXboxTF{}}
\renewcommand{\boxEX}[2][9pt]{%
\def\sizeboxEX{#1}%
\setbox1=\hbox{#2}%
\ \EXbox{}\ %
\ExecuteOptions{dethi}
\ProcessOptions
\theorempreskipamount0.1\baselineskip
\theorempostskipamount0.2\baselineskip
\newlength\dorongfix
\dorongfix=\linewidth
\newlength\dorong
\dorong=\linewidth
\newcommand{\reducedstrut}{\vrule width 0pt height .9\ht\strutbox depth .9\dp\strutbox\relax}
\def\hfillenum{\hfill}
\makeatletter
\newtheoremstyle{immini}%
\def\thindent{%
\hspace*{\wd0}%
}%
\def\labelthm{##1}%
}%
{%
\ifdim\wd1>0.4\linewidth\relax%
(##3)\theorem@separator\hfill}
\else
\fi
\ifdim\wd1>0.4\linewidth\relax
\def\hfillenum{}
\def\thindent{%
}%
\def\labelthmfull{%
}
\else
\def\hfillenum{\hfill}
\def\thindent{%
\hspace*{\wd0}%
}%
\fi
\def\labelthm{##1}%
\newtheoremstyle{imminib}%
\def\thindent{%
\hspace*{\wd0}%
}%
\def\labelthm{##1}%
}%
{%
\ifdim\wd1>0.4\linewidth\relax%
\else
\fi
\ifdim\wd1>0.4\linewidth\relax
\def\labelex{%
\begin{flushright}
\vspace*{-5pt}
\textit{\textbf{(##3)}}
\vspace*{-5pt}
\end{flushright}}
\def\thindent{%
\hspace*{\wd0}%
}%
\else
\def\thindent{%
\hspace*{\wd0}%
}%
\fi
\def\labelthm{##1}%
\newtheoremstyle{exbreak}%
(##3)\theorem@separator\hfill}}
\newtheoremstyle{explain}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
\begin{flushright}
\vspace*{-5pt}
\textit{\textbf{(##3)}}
\vspace*{-5pt}
\end{flushright}}}
\newcommand{\listtheorem}[1]{
\AtEndEnvironment{\x}{%
\labelex
}}%
\makeatother
\theoremstyle{immini}
\theoremseparator{.}
\theorembodyfont{\rm}
\Newassociation{solbook}{Solbook}{ansbook}
\renewcommand{\Solbooklabel}[1]{\textbf{\nameex\ #1.}}
\Newassociation{EXsol}{Solution}{ans}
\Newassociation{sol}{Solution}{ans_old}
\newtheorem{ex}{\nameex}
\AtBeginEnvironment{Solbook}{
\renewcommand{\IMleftright}[3]{
\par\noindent
\begin{minipage}[t][][t]{\linewidth-\widthimmini-4\fboxsep-#1\linewidth}
#2
\end{minipage}
\hspace{#1\linewidth}\hspace{2\fboxsep}
\begin{minipage}[t][][b]{\widthimmini}\vspaceIM
#3
\end{minipage}
\par\nointerlineskip
\newtheorem{vdex}{Ví dụ}
\AtBeginEnvironment{vdex}{\setcounter{numTrueSol}{0}\def\dotEX{.}}
\def\vspaceIM{\vspace{-0.5\baselineskip}}
\def\breakIM{\filbreak}
\def\numpicinpar{0}
\newdimen\heightline
\newdimen\widthimmini
\newdimen\heightimmini
\newdimen\heighttextimmini
\newdimen\himmini
\newdimen\spaceleft
\newbox\imbox
\newbox\imboxtext
\newcommand{\hspaceIM}[1]{
\def\hspaceIMEX{\hspace{#1\linewidth}}
\def\hspaceEXIM{#1\linewidth}
\newcommand{\IMleftright}[3]{
\hfill\par\noindent
\begin{minipage}[t][][t]{\linewidth-\widthimmini-4\fboxsep-#1\linewidth}
#2
\end{minipage}
\hspace{#1\linewidth}\hspace{2\fboxsep}
\begin{minipage}[t][][b]{\widthimmini}\vspaceIM
#3
\centering \IMname\IMlabel
\end{minipage}
\par\nointerlineskip
\newcommand{\IMrightleft}[3]{
\hfill\par\noindent
\begin{minipage}[t][][b]{\widthimmini}\vspaceIM
#3
\centering \IMname\IMlabel
\end{minipage}
\hspace{#1\linewidth}\hspace{2\fboxsep}
\begin{minipage}[t][][t]{\linewidth-\widthimmini-4\fboxsep-#1\linewidth}
#2
\end{minipage}
\par\nointerlineskip
\newcommand{\immini}[3][0]{
\savebox{\imbox}{#3}
\widthimmini=\wd\imbox
\heightimmini=\ht\imbox
\ifthenelse{\equal{#1}{thm}}
{%
\savebox{\imboxtext}{\vbox{#2}}
\xdef\saveFileAns{}\xdef\keyEX{}\setcounter{dapan}{0}
\vspace{-0.3\baselineskip}
\leavevmode\nopagebreak\IMleftright{0}{\protect\leavevmode\labelthmfull#2}{#3}
\IMleftright{#1}{#2}{#3}
\newcommand{\imminiL}[3][0]{
\setbox\imbox=\vbox{\hbox{#3}}
\widthimmini=\wd\imbox
\heightimmini=\ht\imbox
\spaceleft=\dimexpr\textheight-\pagetotal-2\baselineskip\relax
\ifdim\heightimmini>\spaceleft
\breakIM
\fi
\IMrightleft{#1}{#2}{#3}
%%===================================
\makeatletter
\def\IMheight{2mm}
\def\title{}
%\@ifpackageloaded{tcolorbox}{%
% \makeatletter
% \newcommand{\immini}[3][]{%
% \ifthenelse{\equal{##1}{}}{}{%
% \ifthenelse{\equal{##1}{thm}}{}%
% {\def\IMheight{##1cm}}}%
% \savebox{\imbox}{##3}%
% \tcbsidebyside[blanker,
% sidebyside adapt=right,
% sidebyside gap=\IMheight,
% top=0pt,left=0pt,right=0pt,bottom=0pt,
% ]{{\title}##2}{\usebox{\imbox}}%
% \gdef\title{}%
% }
% \newcommand{\imminiL}[3][]{%
% \ifthenelse{\equal{##1}{}}{}{%
% \ifthenelse{\equal{##1}{thm}}{}%
% {\def\IMheight{##1cm}}}%
% \savebox{\imbox}{##3}%
% \tcbsidebyside[blanker,
% sidebyside adapt=left,
% sidebyside gap=\IMheight,
% top=0pt,left=0pt,right=0pt,bottom=0pt,
% ]{\usebox{\imbox}}{{\title}##2}%
% \gdef\title{}%
% }
% \newcommand{\fiximmini}[2][]{
% \ifcsname #2\endcsname
% \NewImmini
% \renewenvironment{#2}[1][]{%
% \refstepcounter{#2}%
% \ifthenelse{\equal{##1}{}}{%
% \@ifnextchar\immini{\gdef\title{\bf#1{ }\@currentlabel.}}%
% {\@ifnextchar\imminiL{\gdef\title{\bf#1{ }\@currentlabel.}}%
% }{%
% }}{\gdef\title{}}
% \fi
% }
% \fiximmini[\nameex]{ex}
%}{%
% \newcommand{\fiximmini}[2][]{{\noindent\bf\large\color{red}
% \begin{itemize}
% \item Gói lệnh {\color{blue}tcolorbox} cần được khai báo trước khi khai
báo gói ex-test.
% \end{itemize}
% }}%
%}
\@ifpackageloaded{tcolorbox}{%
\newcommand{\NewImmini}{%
%Lệnh \immini theo khai báo của thầy Trần Lê Nam
\makeatletter
\renewcommand{\immini}[3][]{%
\ifthenelse{\equal{##1}{}}{}{%
\ifthenelse{\equal{##1}{thm}}{}%
{\def\IMheight{##1cm}}}%
\savebox{\imbox}{##3}%
\tcbsidebyside[blanker,
sidebyside adapt=right,
sidebyside gap=\IMheight,
top=0pt,left=0pt,right=0pt,bottom=0pt,
]{{\title}##2}{\usebox{\imbox}}%
\gdef\title{}%
\renewcommand{\imminiL}[3][]{%
\ifthenelse{\equal{##1}{}}{}{%
\ifthenelse{\equal{##1}{thm}}{}%
{\def\IMheight{##1cm}}}%
\savebox{\imbox}{##3}%
\tcbsidebyside[blanker,
sidebyside adapt=left,
sidebyside gap=\IMheight,
top=0pt,left=0pt,right=0pt,bottom=0pt,
]{\usebox{\imbox}}{{\title}##2}%
\gdef\title{}%
}
}
\newcommand{\fiximmini}[2][]{%
\ifthenelse{\equal{#1}{}}
{\ifthenelse{\equal{#2}{ex}}
{\def\namefix{\nameex}}
{\ifthenelse{\equal{#2}{bt}}
{\def\namefix{\namebt}}
{}\ifthenelse{\equal{#2}{vd}}
{\def\namefix{\namevd}}
{\def\namefix{#1}}}}
{\def\namefix{#1}}%
\ifcsname #2\endcsname
\NewImmini
\renewenvironment{#2}[1][]{%
\refstepcounter{#2}%
\ifthenelse{\equal{##1}{}}{%
\@ifnextchar\immini{\gdef\title{\bf\namefix{ }\
@currentlabel.}}%
{\@ifnextchar\imminiL{\gdef\title{\bf\namefix{ }\
@currentlabel.}}%
{\par\noindent\textbf{\bf\namefix{ }\@currentlabel.
{ }}}}%
}{%
\@ifnextchar\immini{\gdef\title{\bf\namefix{ }\
@currentlabel{ }(##1).}}%
{\@ifnextchar\imminiL{\gdef\title{\bf\namefix{ }\
@currentlabel{ }(##1).}}%
{\par\noindent\textbf{\namefix{ }\@currentlabel{ }
(##1).{ }}}}%
}}{\gdef\title{}}
\fi
}{%
\newcommand{\fiximmini}[2][]{{\noindent\bf\large\color{red}
\begin{itemize}
\item Gói lệnh {\color{blue}tcolorbox} cần được khai báo trước khi khai báo gói
ex-test.
\end{itemize}
}}%
%%===================================
\newcommand{\impicinpar}[2]{
\begin{window}[\numpicinpar,r,{
#2
}, {}]
\begin{flushleft}
#1
\end{flushleft}
\end{window}
\usetikzlibrary{decorations.pathreplacing,decorations.markings,patterns}
\def\colorInterval{black}
\def\skipInterval{0.4cm}
\newcommand{\Interval}[4]{%
\newcommand{\IntervalR}[4]{%
with
}}] {(a)--(b)};
\newcommand{\IntervalL}[4]{%
\draw decorate[decoration={
markings,
with
}
}
] {(a)--(b)};
\newcommand{\IntervalLF}[4]{%
\newcommand{\IntervalRF}[4]{%
\def\pre{0}
\def\next{2}
\newcommand{\IntervalLR}[2]{
\def\pre{#1}
\def\next{#2}
\newcommand{\IntervalG}[4]{%
\newcommand{\IntervalGL}[4]{%
with
}}] {(a)--(b)};
\newcommand{\IntervalGR}[4]{%
with
}}] {(a)--(b)};
\newcommand{\IntervalGLF}[4]{%
\newcommand{\IntervalGRF}[4]{%
}
%Định nghĩa dots fill
\xdef\blskip{\the\baselineskip}
\xdef\pskip{\the\parskip}
\xdef\mtcs{\the\multicolsep}
\newcommand{\dotlineEX}[2][1]{%
\baselineskip=22pt%
\setlength{\multicolsep}{1pt}%
\setlength{\parskip}{0pt}%
\xdef\numline{#2}%
\xdef\numlinedot{\the\numexpr#2*#1}%
\ifnum#1=1
{\noindent\ifnum\dotline=1\reflectbox{\large\HandPencilLeft}\fi\dotfill\par}
\else\begin{multicols}{#1}
{\pgfmathparse{int((\dotline-1)*100/\numline-100*int((\dotline-1)/\
numline))}
\noindent\ifnum\pgfmathresult=0\reflectbox{\large\HandPencilLeft}\fi\
dotfill\par}
\end{multicols}
\fi
\vspace{8pt}\noindent%
\setlength{\multicolsep}{\mtcs}%
\setlength{\parskip}{\pskip}%
\baselineskip=\blskip%
\newsavebox{\myboxans}
\newcommand{\boxans}
\renewenvironment{Solution}[1]
{\begin{lrbox}{\myboxans}\begin{minipage}{0.1\linewidth-4\fboxsep}
\parbox[b]{0.55\linewidth}{\color{blue}##1.}
\color{violet}
{\end{minipage}\end{lrbox}\fbox{\usebox{\myboxans}}}
\newcommand{\listans}
\renewenvironment{Solution}[1]
{{\color{blue}##1}\hspace*{-4pt}}
{\hspace*{-5pt}}
\newcommand{\tabans}[1]
\renewenvironment{Solution}[1]
{\begin{minipage}{\linewidth/#1-1.2\fboxsep}
\parbox[b]{0.45\linewidth}{
\raggedleft\color{blue}##1.
\color{violet}
{\end{minipage}}
\newcommand{\rowans}
{
\renewenvironment{Solution}[1]
{\begin{minipage}{0.1\linewidth-1.2\fboxsep}
\parbox[b]{0.45\linewidth}{
\raggedleft\color{blue}##1.
\color{violet}
{\end{minipage}}
\makeatletter
\newlength{\contentlength}
\newlength{\lengthCD}\settowidth{\lengthCD}{CD}
\def\firstofpair#1,#2{#1}
\def\secondofpair#1,#2{#2}
\newcommand{\inputans}[3][]{%
\ifthenelse{\equal{#1}{0}}{\Onlycirc}
{\ifthenelse{\equal{#1}{1}}{\Fullcirc}{\Returncirc}}%
\IfSubStr{#2}{,}
{\def\numABCD{\expandafter\firstofpair#2\relax}%
\def\numTFSA{\expandafter\secondofpair#2\relax}%
\Onlycirc}%
{\def\numABCD{#2}\def\numTFSA{#2}}%
{\fontfamily{qcs}\small\selectfont%
\RenewEnviron{Solution}[1]{%
\settowidth{\contentlength}{\BODY}%
\begin{lrbox}{\myboxans}
\ifdim\contentlength<\lengthCD
\begin{minipage}{\dimexpr\linewidth/\numABCD-4.28\fboxsep\relax}\else%
\begin{minipage}{\dimexpr\linewidth/\numTFSA-4.28\fboxsep\relax}\fi%
\parbox[b]{8mm}{\raggedleft\color{blue}##1.}\,\color{violet}\BODY%
\end{minipage}
\end{lrbox}\noindent\usebox{\myboxans}\;\vspace{0.15mm}
}%
\begin{flushleft}%
\foreach \file in {#3}{% Nếu muốn giữa 2 file được nhập có xuống dòng thì gõ file1 ,, file
2
\IfStrEq{\file}{}{\vspace{0.3mm}\par}{\input{\file}}%
\end{flushleft}
}}
\newcommand{\inputansbox}[3][]{%
\ifthenelse{\equal{#1}{0}}{\Onlycirc}
{\ifthenelse{\equal{#1}{1}}{\Fullcirc}{\Returncirc}}%
\IfSubStr{#2}{,}
{\def\numABCD{\expandafter\firstofpair#2\relax}%
\def\numTFSA{\expandafter\secondofpair#2\relax}%
\Onlycirc}%
{\def\numABCD{#2}\def\numTFSA{#2}}%
{\fontfamily{qcs}\small\selectfont%
\RenewEnviron{Solution}[1]{%
\settowidth{\contentlength}{\BODY}%
\begin{lrbox}{\myboxans}
\ifdim\contentlength<\lengthCD
\begin{minipage}{\dimexpr\linewidth/\numABCD-4.28\fboxsep\relax}
\color{blue}##1.
\hfill\color{violet}\BODY%
\end{minipage}
\else
\begin{minipage}{\dimexpr\linewidth/\numTFSA-4.28\fboxsep\relax}
\parbox[b]{15mm}{\color{blue}\nameexans~##1.}
\hfill\color{violet}\BODY%
\end{minipage}
\fi
\end{lrbox}\noindent\fbox{\usebox{\myboxans}}\;\vspace{0.15mm}
}%
\begin{flushleft}%
\foreach \file in {#3}{% Nếu muốn giữa 2 file được nhập có xuống dòng thì gõ file1 ,, file
2
\IfStrEq{\file}{}{\vspace{0.3mm}\par}{\input{\file}}%
\end{flushleft}
}}
\newcommand{\inputansTF}[3][2]{\inputans[#1]{#2}{#3}}
\newcommand{\inputansSA}[3][2]{\inputans[#1]{#2}{#3}}
\newcommand{\inputansboxTF}[3][2]{\inputansox[#1]{#2}{#3}}
\newcommand{\inputansboxSA}[3][2]{\inputansox[#1]{#2}{#3}}
\makeatletter
\@ifclasswith{article}{a5paper}
{%
\renewcommand{\rowans}
\renewenvironment{Solution}[1]
{\begin{minipage}{0.2\linewidth-1.2\fboxsep}
\parbox[b]{0.45\linewidth}{\color{blue}##1.}
\color{violet}
{\end{minipage}}
}{%
\@ifclasswith{book}{a5paper}
{%
\renewcommand{\rowans}
\renewenvironment{Solution}[1]
{\begin{minipage}{0.2\linewidth-1.2\fboxsep}
\parbox[b]{0.45\linewidth}{\color{blue}##1.}
\color{violet}
{\end{minipage}}
}{%
\makeatother
\def\hideans{
\renewcommand{\inputansbox}[2]{%
}%
\renewcommand{\inputans}[2]{%
}%
\renewcommand{\tabans}[1]{%
}%
}
\newenvironment{fileEX}{\filecontents}{\endfilecontents}
\newcommand{\bankEX}[2]{
\input{#1}
\newtheorem{exrd}{Câu}
\def\listfile{
\bankEX{onefile.tex}{50}
\def\testname{
\begin{center}
\end{center}
\rightline{
\setlength\fboxrule{2pt}
\setlength\fboxsep{5pt}
\newcommand{\randombank}[1]{
%\testname
\begin{center}
\textbf{
\color{red}
Bạn đang chạy bằng gói ex\_test xuất ra MỌI CÂU HỎI của ngân hàng nhằm soát lỗi.\\
Khi mọi thứ đã OK, hãy thay khai báo gói ex\_test bằng gói ex\_test\_rd
}
\end{center}
\Opensolutionfile{ans}[ans/ans_ex_test]
\listfile
\Closesolutionfile{ans}
%Đường tròn LG
\usetikzlibrary{plotmarks}
\newcommand{\trucLG}{
\newcommand{\pointLG}[4]
\foreach \i in {0,...,#2}
\draw[color=#4]
\makeatletter
\def\sizeboxEX{9pt}
\def\EXbox#1{%
\begingroup%
\setlength{\fboxsep}{0.3ex}%
\setlength{\@tempdima}{\sizeboxEX}%
\setlength{\@tempdimb}{(\@tempdima-\ht1+\dp1)/2}%
\raise-\@tempdimb\hbox{\fbox{\vbox to \@tempdima{%
\vfil\hbox to \@tempdima{\hfil#1\hfil}\vfil}}}%
\endgroup%
\def\EXboxTF#1{%
\begingroup%
\setlength{\fboxsep}{0.3ex}%
\setbox1=\hbox{#1}%
\setlength{\@tempdima}{\sizeboxEX}%
\fbox{\vbox to \@tempdima{%
\vfil\hbox to \@tempdima{\hfil\copy1\hfil}\vfil}}%
\endgroup%
\makeatother
\ExplSyntaxOn
\cs_generate_variant:Nn \tl_if_eq:nnTF { V }
\cs_generate_variant:Nn \tl_if_eq:nnT { V }
% --------------------------------------------------------------------------
% variables:
\seq_new:N \l__listsEX_seq
\int_new:N \l__listsEX_depth_int
\int_new:N \g__listsEX_int
\int_new:N \g__listsEX_total_items_int
\int_new:N \l__listsEX_columns_int
\int_new:N \l__listsEX_rows_int
\int_new:N \g__listsEX_current_col_num_int
\int_new:N \g__listsEX_current_row_num_int
\int_new:N \l__listsEX_item_columns_int
\bool_new:N \l__listsEX_enumerate_bool
\bool_new:N \l__listsEX_resume_bool
\bool_new:N \l__listsEX_load_listsEX_bool
\bool_new:N \l__listsEX_label_width_bool
\bool_new:N \l__listsEX_item_indent_bool
\bool_new:N \l__listsEX_label_offset_bool
\bool_new:N \l__listsEX_custom_label_bool
\bool_new:N \l__listsEX_custom_after_item_skip_bool
\bool_new:N \l__listsEX_debug_bool
\bool_new:N \l__listsEX_item_full_line_bool
\bool_new:N \l__listsEX_item_rest_of_line_bool
\tl_new:N \l__listsEX_instance_tl
\tl_new:N \l__listsEX_label_tl
\tl_new:N \l__listsEX_custom_label_tl
\tl_new:N \l__listsEX_label_pattern_tl
\tl_new:N \l__listsEX_custom_label_pattern_tl
\tl_new:N \l__listsEX_label_format_tl
\tl_new:N \l__listsEX_custom_label_format_tl
\tl_new:N \l__listsEX_item_format_tl
\tl_new:N \l__listsEX_custom_item_format_tl
\tl_new:N \l__listsEX_item_fill_left_tl
\tl_new:N \l__listsEX_item_fill_right_tl
\tl_new:N \l__listsEX_label_align_tl
% \tl_new:N \listEX
\tl_new:N \l__listsEX_item_tl
\tl_new:N \l__listsEX_tmp_label_tl
\dim_new:N \l__listsEX_item_indent_dim
\dim_new:N \l__listsEX_item_default_indent_dim
\dim_new:N \l__listsEX_item_width_dim
\dim_new:N \l__listsEX_label_width_dim
\dim_new:N \l__listsEX_label_default_width_dim
\dim_new:N \l__listsEX_label_offset_dim
\dim_new:N \l__listsEX_label_default_offset_dim
\dim_new:N \l__listsEX_column_sep_dim
\skip_new:N \l__listsEX_after_item_skip
\skip_new:N \l__listsEX_custom_after_item_skip
\skip_new:N \l__listsEX_before_list_skip
\skip_new:N \l__listsEX_after_list_skip
\coffin_new:N \l__listsEX_item_coffin
\coffin_new:N \l__listsEX_label_coffin
% temporary variables:
\int_new:N \l__listsEX_tmpa_int
\int_new:N \l__listsEX_tmpb_int
\tl_new:N \l__listsEX_tmpa_tl
\coffin_new:N \l__listsEX_tmpa_coffin
\cs_new:Npn \__listsEX_debug:n #1
\bool_if:NTF \l__listsEX_debug_bool
{ \fbox {#1} }
{ \use:n {#1} }
% --------------------------------------------------------------------------
\end {#3}
{ \__listsEX_collect_listsEX:nww {#1} }
% #1: instance
\int_gset:Nn \g__listsEX_total_items_int
{ \seq_count:N \l__listsEX_seq }
{ \g__listsEX_total_items_int }
{#2}
{ \l__listsEX_custom_label_pattern_tl }
% just to be sure:
\seq_clear:N \l__listsEX_seq
% #1: label
% #3: item
\bool_if:NT \l__listsEX_item_full_line_bool
% mode:
\mode_if_horizontal:T
{ \skip_vertical:N \l__listsEX_after_item_skip }
\listsEX_new_row:
}
\int_gincr:N \g__listsEX_current_col_num_int
\dim_set:Nn \l__listsEX_item_width_dim
\bool_if:NTF \l__listsEX_item_full_line_bool
{ \linewidth }
\linewidth
-\fboxsep
- \l__listsEX_columns_int \l__listsEX_column_sep_dim
+ \l__listsEX_column_sep_dim
) / \l__listsEX_columns_int
- \l__listsEX_depth_int \l__listsEX_item_indent_dim
\__listsEX_gset_rows_num:NN
\g__listsEX_total_items_int
\l__listsEX_columns_int
\int_compare:nNnT
\int_gset:Nn \g__listsEX_current_col_num_int { 1 }
\int_incr:N \g__listsEX_current_row_num_int
}
\bool_if:NT \l__listsEX_item_rest_of_line_bool
\int_set:Nn \l__listsEX_tmpa_int
{ \l__listsEX_columns_int - \g__listsEX_current_col_num_int + 1 }
\int_compare:nNnTF { \l__listsEX_item_columns_int } = { 0 }
\int_compare:nNnTF
{ \int_zero:N \l__listsEX_item_columns_int }
\bool_if:nT
\l__listsEX_item_rest_of_line_bool &&
!\int_compare_p:nNn { \l__listsEX_item_columns_int} = { 0 }
\int_gadd:Nn \g__listsEX_current_col_num_int
{ \l__listsEX_item_columns_int -1 }
\int_gadd:Nn \g__listsEX_total_items_int
{ \l__listsEX_item_columns_int -1 }
\dim_set:Nn \l__listsEX_item_width_dim
{
\l__listsEX_tmpa_int \l__listsEX_item_width_dim
+ \l__listsEX_tmpb_int \l__listsEX_column_sep_dim
+ \l__listsEX_tmpb_int \l__listsEX_item_indent_dim
\bool_if:NT \l__listsEX_debug_bool
\hcoffin_set:Nn \l__listsEX_item_coffin
\vcoffin_set:Nnn \l__listsEX_tmpa_coffin
{ \l__listsEX_item_width_dim }
\__listsEX_debug:n
\coffin_typeset:Nnnnn \l__listsEX_tmpa_coffin
\hcoffin_set:Nn \l__listsEX_label_coffin
\vcoffin_set:Nnn \l__listsEX_tmpa_coffin
\l__listsEX_label_width_dim
}
{
\noindent
\tl_use:N \l__listsEX_item_fill_left_tl
\strut #1
\tl_use:N \l__listsEX_item_fill_right_tl
\__listsEX_debug:n
\coffin_typeset:Nnnnn \l__listsEX_tmpa_coffin
% attach the label box at the left of the item box, shifted by
% \l__listsEX_label_offset_dim :
\coffin_attach:NnnNnnnn
\dim_compare:nNnTF
{ \l__listsEX_item_indent_dim }
<
{ \l__listsEX_label_offset_dim + \l__listsEX_label_width_dim }
{0pt}
{ - \l__listsEX_label_width_dim - \l__listsEX_label_offset_dim }
} { 0pt }
\int_compare:nNnT { \g__listsEX_current_col_num_int } = { 1 }
{ \skip_vertical:N \c_zero_skip }
% skip horizontally by \l__listsEX_item_indent_dim
\noindent
\skip_horizontal:N \l__listsEX_item_indent_dim
% typeset the item (with the attached label protruding to the left):
\coffin_typeset:Nnnnn \l__listsEX_item_coffin
{l}
{T}
{0pt}
{0pt}
\bool_if:nT
\l__listsEX_item_full_line_bool ||
\l__listsEX_item_rest_of_line_bool &&
\int_compare_p:nNn { \l__listsEX_item_columns_int } = { 0 }
{ \listsEX_new_row: }
\int_compare:nNnT
{ \skip_horizontal:N \l__listsEX_column_sep_dim }
% \l__listsEX_after_item_skip :
\bool_if:nT
&&
( \int_compare_p:n { \g__listsEX_current_row_num_int != \l__listsEX_rows_int } )
{ \skip_vertical:N \l__listsEX_after_item_skip }
% clean up:
\coffin_clear:N \l__listsEX_item_coffin
\coffin_clear:N \l__listsEX_label_coffin
\coffin_clear:N \l__listsEX_tmpa_coffin
\bool_set_false:N \l__listsEX_item_full_line_bool
\bool_set_false:N \l__listsEX_item_rest_of_line_bool
\cs_new_protected:Npn \__listsEX_setup:
\noindent
\dim_compare:nNnT
{ \l__listsEX_item_indent_dim }
<
{ \l__listsEX_label_offset_dim + \l__listsEX_label_width_dim }
\skip_horizontal:n
\l__listsEX_label_offset_dim
+ \l__listsEX_label_width_dim
- \l__listsEX_item_indent_dim
\strut
{ \int_gincr:N \l__listsEX_rows_int }
\cs_new_protected:Npn \__listsEX_label_align:n #1
\str_case:nnF {#1}
{left}
\tl_clear:N \l__listsEX_item_fill_left_tl
{right}
\tl_clear:N \l__listsEX_item_fill_right_tl
{center}
{
\tl_clear:N \l__listsEX_item_fill_left_tl
\cs_generate_variant:Nn \__listsEX_label_align:n { V }
\__listsEX_label_align:n {left}
% --------------------------------------------------------------------------
% #3: label-format
label : tokenlist ,
label-format : tokenlist ,
item-format : tokenlist ,
% in the next three commands we want a really unlikely to occur marker; for
\cs_set:Nx \__listsEX_restore_dollar:
\char_set_catcode_alignment:N \$
enumerate = \l__listsEX_enumerate_bool ,
label = \l__listsEX_label_tl ,
indent = \l__listsEX_item_default_indent_dim ,
counter-format = \l__listsEX_label_pattern_tl ,
label-format = \l__listsEX_label_format_tl ,
label-width = \l__listsEX_label_default_width_dim ,
label-offset = \l__listsEX_label_default_offset_dim ,
item-format = \l__listsEX_item_format_tl ,
after-item-skip = \l__listsEX_after_item_skip
\AssignTemplateKeys
\bool_if:NF \l__listsEX_label_width_bool
{
\dim_set_eq:NN
\l__listsEX_label_width_dim
\l__listsEX_label_default_width_dim
\bool_if:NF \l__listsEX_item_indent_bool
\dim_set_eq:NN
\l__listsEX_item_indent_dim
\l__listsEX_item_default_indent_dim
\bool_if:NF \l__listsEX_label_offset_bool
\dim_set_eq:NN
\l__listsEX_label_offset_dim
\l__listsEX_label_default_offset_dim
\bool_if:NT \l__listsEX_custom_after_item_skip_bool
\skip_set_eq:NN
\l__listsEX_after_item_skip
\l__listsEX_custom_after_item_skip
\bool_if:NT \l__listsEX_custom_label_bool
\tl_set_eq:NN
\l__listsEX_label_tl
\l__listsEX_custom_label_tl
\bool_set_false:N \l__listsEX_enumerate_bool
}
\__listsEX_label_align:V \l__listsEX_label_align_tl
{ \int_gzero:N \g__listsEX_int }
% set all the items in their own coffins and join with the ground:
\int_gzero:N \g__listsEX_current_col_num_int
\tl_if_blank:VF \l__listsEX_custom_label_pattern_tl
\tl_set_eq:NN
\l__listsEX_label_pattern_tl
\l__listsEX_custom_label_pattern_tl
\tl_if_blank:VF \l__listsEX_custom_label_format_tl
\tl_set_eq:NN
\l__listsEX_label_format_tl
\l__listsEX_custom_label_format_tl
\tl_if_blank:VF \l__listsEX_custom_item_format_tl
\tl_set_eq:NN
\l__listsEX_item_format_tl
\l__listsEX_custom_item_format_tl
\seq_map_inline:Nn \l__listsEX_seq
{
\bool_if:NTF \l__listsEX_enumerate_bool
\int_gincr:N \g__listsEX_int
\SaveCounterPatternFrom [listsEX]
\l__listsEX_tmpa_tl
\l__listsEX_label_tl
\l__listsEX_label_pattern_tl
\tl_if_blank:VT \l__listsEX_label_tl
\__listsEX_listEX:VVV
\l__listsEX_label_tl
\l__listsEX_item_format_tl
\l__listsEX_item_tl
\__listsEX_listEX:VVV
\l__listsEX_tmp_label_tl
\l__listsEX_item_format_tl
\l__listsEX_item_tl
\tl_clear:N \l__listsEX_tmp_label_tl
\cs_new_protected:Npn \__listsEX_read_item:www
\peek_meaning_remove:NTF !
\bool_set_true:N \l__listsEX_item_full_line_bool
\__listsEX_read_item_aux:ww
\peek_meaning_remove:NTF *
\bool_set_true:N \l__listsEX_item_rest_of_line_bool
\__listsEX_read_item_rest_of_line:ww
{ \__listsEX_read_item_aux:ww }
\cs_new_protected:Npn \__listsEX_read_item_rest_of_line:ww
\peek_meaning:NTF ( % )
{ \__listsEX_read_item_rest_of_line_aux:ww }
{ \__listsEX_read_item_rest_of_line_aux:ww (0) }
\__listsEX_read_item_aux:ww
\cs_new_protected:Npn \__listsEX_read_item_aux:ww
\peek_meaning:NTF [ % ]
{ \__listsEX_read_item_aux_ii:ww }
{ \__listsEX_read_item_aux_ii:ww [$listsEX$default$label$] }
\tl_if_eq:nnF { #1 } { $listsEX$default$label$ }
\__listsEX_restore_dollar:
% --------------------------------------------------------------------------
% choice box:
\bool_new:N \l__listsEX_choice_checked_bool
\dim_new:N \l__listsEX_choice_width_dim
\dim_new:N \l__listsEX_choice_linewidth_dim
\dim_new:N \l__listsEX_choice_checkwidth_dim
\dim_new:N \l__listsEX_choice_raise_dim
\cs_new_protected:Npn \listsEX_choice:
\leavevmode
\group_begin:
\bool_set_false:N \l__listsEX_choice_checked_bool
\box_move_up:nn
{ \l__listsEX_choice_raise_dim }
{ \hbox:n { \__listsEX_choice: } }
\group_end:
\cs_new_protected:Npn \listsEX_choice_checked:
\leavevmode
\group_begin:
\bool_set_true:N \l__listsEX_choice_checked_bool
\box_move_up:nn
{ \l__listsEX_choice_raise_dim }
{ \hbox:n { \__listsEX_choice: } }
\group_end:
\cs_new_protected:Npn \__listsEX_choice:
{%
\begin{picture}(10,0)
\linethickness \l__listsEX_choice_linewidth_dim
\drawline(0,0)(0,10)(10,10)(10,0)(0,0)
\linethickness \l__listsEX_choice_checkwidth_dim
\bool_if:NT \l__listsEX_choice_checked_bool
\drawline(2,2)(8,8)
\drawline(2,8)(8,2)
\end{picture}%
% --------------------------------------------------------------------------
% base instance:
% ALPHABETIZE: a) b) c)
label .code:n =
\bool_set_true:N \l__listsEX_custom_label_bool
label-width .code:n =
\bool_set_true:N \l__listsEX_label_width_bool ,
label-offset .code:n =
\bool_set_true:N \l__listsEX_label_offset_bool ,
item-indent .code:n =
\bool_set_true:N \l__listsEX_item_indent_bool ,
after-item-skip .code:n =
\bool_set_true:N \l__listsEX_custom_after_item_skip_bool
% --------------------------------------------------------------------------
\if@inlabel
\noindent\par\nobreak\vskip-\parskip\vskip-\baselineskip\hrule\@height\z@
\fi
{ \vspace {\l__listsEX_before_list_skip} }
\list {}
\item \scan_stop:
\int_incr:N \l__listsEX_depth_int
\endlist
{ \vspace {\l__listsEX_after_list_skip} }
% --------------------------------------------------------------------------
\cs_new_protected:Npn \listsEX_new_row:
{
\int_gset:Nn \g__listsEX_total_items_int
\g__listsEX_total_items_int +
\l__listsEX_columns_int -
\g__listsEX_current_col_num_int
\__listsEX_gset_rows_num:NN
\g__listsEX_total_items_int
\l__listsEX_columns_int
\NewDocumentCommand \startnewitemlineEX {}
{ \listsEX_new_row: }
% --------------------------------------------------------------------------
{ \end__listsEX_env: }
% --------------------------------------------------------------------------
% default list:
\NewListsEX {listsEX}
\file_if_exist:nT {listsEX.cfg} { \file_input:n {listsEX.cfg} }
% --------------------------------------------------------------------------
% setup:
\cs_new_protected:Npn \listsEX_setup:n #1
\NewDocumentCommand \setlistsEX { m }
{ \listsEX_setup:n {#1} }
\newcommand{\StartNumber}[1]{
%tasks
\NewListsEX{taskEX}[\item]
\NewEnviron{listEX}[1][]{%
\ifthenelse{\equal{#1}{}}{%
\begin{enumerate}[a)]%
\BODY%
\end{enumerate}%
}{%
\ifthenelse{\equal{#1}{1}}%
{%
\begin{enumerate}[a)]%
\BODY%
\end{enumerate}%
}%
{\def\tempbegin{\begin{taskEX}(#1)}%
\expandafter\tempbegin\BODY%
\end{taskEX}}%
}%
\NewEnviron{enumEX}[2][]{%
\ifthenelse{\equal{#2}{1}}
\ifthenelse{\equal{#1}{}}
\begin{enumerate}
\BODY
\end{enumerate}
\begin{enumerate}[#1]
\BODY
\end{enumerate}}
\ifthenelse{\equal{#1}{}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[a])](#2)}%
}{%
\ifthenelse{\equal{#1}{a.}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[a].](#2)}%
}{
\ifthenelse{\equal{#1}{(a)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=(tsk[a]),label-width=1.3em](#2)}%
}{
\ifthenelse{\equal{#1}{a)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[a])](#2)}%
}{
\ifthenelse{\equal{#1}{A.}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[A].](#2)}%
}{
\ifthenelse{\equal{#1}{(A)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=(tsk[A]),label-width=1.3em](#2)}%
}{
\ifthenelse{\equal{#1}{A)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[A])](#2)}%
}{
\ifthenelse{\equal{#1}{1.}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[1].](#2)}%
}{
\ifthenelse{\equal{#1}{(1)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=(tsk[1]),label-width=1.3em](#2)}%
}{
\ifthenelse{\equal{#1}{1)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[1])](#2)}%
}{
\ifthenelse{\equal{#1}{i.}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[r].](#2)}%
}{
\ifthenelse{\equal{#1}{(i)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=(tsk[r]),label-width=1.4em](#2)}%
}{
\ifthenelse{\equal{#1}{i)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[r])](#2)}%
}{
\ifthenelse{\equal{#1}{I.}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[R].,label-width=1.4em](#2)}%
}{
\ifthenelse{\equal{#1}{(I)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=(tsk[R]),label-width=1.6em](#2)}%
}{
\ifthenelse{\equal{#1}{I)}}{%
\def\tempbegin{\begin{taskEX}[counter-format=tsk[R]),label-width=1.4em](#2)}%
}{
\def\tempbegin{\begin{taskEX}[label=#1](#2)}%
}}}}}}}}}}}}}}}
\expandafter\tempbegin\BODY
\end{taskEX}
\NewEnviron{enumEXV}[2][]{%
\ifthenelse{\equal{#1}{}}
\begin{multicols}{#2}
\begin{enumerate}
\BODY
\end{enumerate}
\end{multicols}
{
\begin{multicols}{#2}
\begin{enumerate}[#1]
\BODY
\end{enumerate}
\end{multicols}
}%