admin管理员组文章数量:1355529
what I would like to achieve are the following
- the choice label should be without a dot (for example "A The first choice" instead of "A. The first choice");
- I would like the correct choice (not the choice label) to be underlined and highlighted in green.
Here is the basic code
\documentclass[answers]{exam}
\usepackage{xcolor}
\begin{document}
\begin{questions}
\question My first question with multiple choices.
\begin{choices}
\choice The first choice
\choice The second choice
\choice The third choice
\CorrectChoice The fourth choice
\end{choices}
\end{questions}
\end{document}
Any help?
Thanks in advance
update 1 following the answer by @samcarter_is_at_topanswers.xyz
I would love to have something like that
Update 2:
I've searched around and maybe I found a solution that might work for what I want to achieve.
The only problem is that both hl and ul are beyond the text.
Any help to solve this problem?
\documentclass[answers]{exam}
\usepackage{xcolor}
\usepackage{soulpos}
\usepackage{ragged2e}
\usepackage{showframe}
\ulposdef{\hlul}{%
\rlap{\textcolor{green}{\rule[-0.75ex]{\ulwidth}{2.5ex}}}%
\rule[-0.3ex]{\ulwidth}{.1ex}%
}
\renewcommand \thechoice{\Alph{choice}}
\renewcommand \choicelabel{\color{black} \textnormal \thechoice}
\CorrectChoiceEmphasis{\color{black} \bfseries \itshape}
\begin{document}
\begin{questions}
\question My first question with multiple choices.
\begin{choices}
\choice The first choice
\choice The second choice
\choice The third choice
\CorrectChoice \hlul{The fourth choice}
\end{choices}
\end{questions}
\hlul{It is a test}
\end{document}
what I would like to achieve are the following
- the choice label should be without a dot (for example "A The first choice" instead of "A. The first choice");
- I would like the correct choice (not the choice label) to be underlined and highlighted in green.
Here is the basic code
\documentclass[answers]{exam}
\usepackage{xcolor}
\begin{document}
\begin{questions}
\question My first question with multiple choices.
\begin{choices}
\choice The first choice
\choice The second choice
\choice The third choice
\CorrectChoice The fourth choice
\end{choices}
\end{questions}
\end{document}
Any help?
Thanks in advance
update 1 following the answer by @samcarter_is_at_topanswers.xyz
I would love to have something like that
Update 2:
I've searched around and maybe I found a solution that might work for what I want to achieve.
The only problem is that both hl and ul are beyond the text.
Any help to solve this problem?
\documentclass[answers]{exam}
\usepackage{xcolor}
\usepackage{soulpos}
\usepackage{ragged2e}
\usepackage{showframe}
\ulposdef{\hlul}{%
\rlap{\textcolor{green}{\rule[-0.75ex]{\ulwidth}{2.5ex}}}%
\rule[-0.3ex]{\ulwidth}{.1ex}%
}
\renewcommand \thechoice{\Alph{choice}}
\renewcommand \choicelabel{\color{black} \textnormal \thechoice}
\CorrectChoiceEmphasis{\color{black} \bfseries \itshape}
\begin{document}
\begin{questions}
\question My first question with multiple choices.
\begin{choices}
\choice The first choice
\choice The second choice
\choice The third choice
\CorrectChoice \hlul{The fourth choice}
\end{choices}
\end{questions}
\hlul{It is a test}
\end{document}
Share
Improve this question
edited yesterday
LastBorn
asked Mar 30 at 18:27
LastBornLastBorn
1219 bronze badges
1 Answer
Reset to default 0You can use
\renewcommand{\choicelabel}{\thechoice{}}
to remove the period at the end of the label\CorrectChoiceEmphasis{\color{green}}
to highlight the correct choice in green
\documentclass[answers]{exam}
\usepackage{xcolor}
\CorrectChoiceEmphasis{\color{green}}
\renewcommand{\choicelabel}{\textcolor{black}{\thechoice{}}}
\begin{document}
\begin{questions}
\question My first question with multiple choices.
\begin{choices}
\choice The first choice
\choice The second choice
\choice The third choice
\CorrectChoice The fourth choice
\end{choices}
\end{questions}
\end{document}
If you compile with lualatex, you could add an underline like this:
% !TeX TS-program = lualatex
\documentclass[answers]{exam}
\usepackage{xcolor}
\usepackage{lua-ul}
\usepackage{luacolor}
\LuaULSetHighLightColor{green}
\makeatletter
\CorrectChoiceEmphasis{\@highLight\@underLine}
\renewcommand{\choicelabel}{\textcolor{black}{\highLight[white]{\underLine[color=white]{\thechoice{}}}}}
\makeatother
\begin{document}
\begin{questions}
\question My first question with multiple choices.
\begin{choices}
\choice The first choice
\choice The second choice
\choice The third choice
\CorrectChoice The fourth choice
\choice test
\end{choices}
\end{questions}
\end{document}
本文标签: Customizing label and choice of exam package in LaTexStack Overflow
版权声明:本文标题:Customizing label and choice of exam package in LaTex - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743978499a2570974.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论