Exam class: TikZ-circled choices not aligned to hanging indent
I am typesetting a competition examination paper, and I wanted to satisfy a very specific requirement for the multiple-choice questions: five choices, each with capital letter choice labels all in equal-sized circles with the labels smack in the centres of the circles, and all aligned to the question text hanging indent. It took me a while, but I have thus far combined the (excellent, detailed and clean) solutions in the following threads:
- Good way to make textcircled numbers?
- Using circled numbers for answer choices in exam document class
- How can I draw circled integers with the same size by TikZ?
- Set indentation of choice in exam documentclass
And thus I have the following MWE:
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt, label={center:#1}, thick] (char) {#1};}}
renewcommandchoicelabel{%
circled{thechoice}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{%
settowidth{leftmargin}{W.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
The thing is, the circles now appear to exceed the hanging indent of the question text and are a bit too far to the left, as shown by the black line I've added in mspaint
. I would like the left edges of the circles to coincide precisely with the hanging indent of the question text; how may I go about doing this?
tikz-pgf exam
add a comment |
I am typesetting a competition examination paper, and I wanted to satisfy a very specific requirement for the multiple-choice questions: five choices, each with capital letter choice labels all in equal-sized circles with the labels smack in the centres of the circles, and all aligned to the question text hanging indent. It took me a while, but I have thus far combined the (excellent, detailed and clean) solutions in the following threads:
- Good way to make textcircled numbers?
- Using circled numbers for answer choices in exam document class
- How can I draw circled integers with the same size by TikZ?
- Set indentation of choice in exam documentclass
And thus I have the following MWE:
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt, label={center:#1}, thick] (char) {#1};}}
renewcommandchoicelabel{%
circled{thechoice}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{%
settowidth{leftmargin}{W.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
The thing is, the circles now appear to exceed the hanging indent of the question text and are a bit too far to the left, as shown by the black line I've added in mspaint
. I would like the left edges of the circles to coincide precisely with the hanging indent of the question text; how may I go about doing this?
tikz-pgf exam
1
Unrelated:label={center:#1}
isn't needed, because you have#1
in the node contents as well, so you end up printing the label twice, in the same place.
– Torbjørn T.
7 hours ago
2
Probably not a good fix, but you could change0em
to3pt
(or thereabouts).
– Torbjørn T.
7 hours ago
add a comment |
I am typesetting a competition examination paper, and I wanted to satisfy a very specific requirement for the multiple-choice questions: five choices, each with capital letter choice labels all in equal-sized circles with the labels smack in the centres of the circles, and all aligned to the question text hanging indent. It took me a while, but I have thus far combined the (excellent, detailed and clean) solutions in the following threads:
- Good way to make textcircled numbers?
- Using circled numbers for answer choices in exam document class
- How can I draw circled integers with the same size by TikZ?
- Set indentation of choice in exam documentclass
And thus I have the following MWE:
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt, label={center:#1}, thick] (char) {#1};}}
renewcommandchoicelabel{%
circled{thechoice}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{%
settowidth{leftmargin}{W.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
The thing is, the circles now appear to exceed the hanging indent of the question text and are a bit too far to the left, as shown by the black line I've added in mspaint
. I would like the left edges of the circles to coincide precisely with the hanging indent of the question text; how may I go about doing this?
tikz-pgf exam
I am typesetting a competition examination paper, and I wanted to satisfy a very specific requirement for the multiple-choice questions: five choices, each with capital letter choice labels all in equal-sized circles with the labels smack in the centres of the circles, and all aligned to the question text hanging indent. It took me a while, but I have thus far combined the (excellent, detailed and clean) solutions in the following threads:
- Good way to make textcircled numbers?
- Using circled numbers for answer choices in exam document class
- How can I draw circled integers with the same size by TikZ?
- Set indentation of choice in exam documentclass
And thus I have the following MWE:
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt, label={center:#1}, thick] (char) {#1};}}
renewcommandchoicelabel{%
circled{thechoice}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{%
settowidth{leftmargin}{W.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
The thing is, the circles now appear to exceed the hanging indent of the question text and are a bit too far to the left, as shown by the black line I've added in mspaint
. I would like the left edges of the circles to coincide precisely with the hanging indent of the question text; how may I go about doing this?
tikz-pgf exam
tikz-pgf exam
edited 7 hours ago
SRSR333
asked 8 hours ago
SRSR333SRSR333
363
363
1
Unrelated:label={center:#1}
isn't needed, because you have#1
in the node contents as well, so you end up printing the label twice, in the same place.
– Torbjørn T.
7 hours ago
2
Probably not a good fix, but you could change0em
to3pt
(or thereabouts).
– Torbjørn T.
7 hours ago
add a comment |
1
Unrelated:label={center:#1}
isn't needed, because you have#1
in the node contents as well, so you end up printing the label twice, in the same place.
– Torbjørn T.
7 hours ago
2
Probably not a good fix, but you could change0em
to3pt
(or thereabouts).
– Torbjørn T.
7 hours ago
1
1
Unrelated:
label={center:#1}
isn't needed, because you have #1
in the node contents as well, so you end up printing the label twice, in the same place.– Torbjørn T.
7 hours ago
Unrelated:
label={center:#1}
isn't needed, because you have #1
in the node contents as well, so you end up printing the label twice, in the same place.– Torbjørn T.
7 hours ago
2
2
Probably not a good fix, but you could change
0em
to 3pt
(or thereabouts).– Torbjørn T.
7 hours ago
Probably not a good fix, but you could change
0em
to 3pt
(or thereabouts).– Torbjørn T.
7 hours ago
add a comment |
1 Answer
1
active
oldest
votes
Here is a proposal. I only changed
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
to change the indent. Big thanks to Torbjørn T. for pointing out that I misread a requirement before.
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt , thick] (char) {#1};}}
renewcommandchoicelabel{circled{Alph{choice}}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f470871%2fexam-class-tikz-circled-choices-not-aligned-to-hanging-indent%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a proposal. I only changed
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
to change the indent. Big thanks to Torbjørn T. for pointing out that I misread a requirement before.
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt , thick] (char) {#1};}}
renewcommandchoicelabel{circled{Alph{choice}}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
add a comment |
Here is a proposal. I only changed
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
to change the indent. Big thanks to Torbjørn T. for pointing out that I misread a requirement before.
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt , thick] (char) {#1};}}
renewcommandchoicelabel{circled{Alph{choice}}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
add a comment |
Here is a proposal. I only changed
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
to change the indent. Big thanks to Torbjørn T. for pointing out that I misread a requirement before.
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt , thick] (char) {#1};}}
renewcommandchoicelabel{circled{Alph{choice}}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
Here is a proposal. I only changed
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
to change the indent. Big thanks to Torbjørn T. for pointing out that I misread a requirement before.
documentclass[preview, class=exam,varwidth=true]{standalone}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{%
node[shape=circle, draw, minimum size=1.5em, inner sep=0pt , thick] (char) {#1};}}
renewcommandchoicelabel{circled{Alph{choice}}}
renewcommand{questionshook}{%
settowidth{leftmargin}{0pt}}
renewcommand{choiceshook}{settowidth{leftmargin}{circled{W}.hskiplabelsephskip 0em}}
begin{document}
begin{questions}
begin{EnvUplevel}
Welcome to the competition.
end{EnvUplevel}
question This is an example of a question.
begin{choices}
choice This is Choice A.
choice This is Choice B.
choice This is Choice C.
choice This is Choice D.
choice This is Choice E.
end{choices}
end{questions}
end{document}
edited 6 hours ago
answered 7 hours ago
marmotmarmot
92.7k4109203
92.7k4109203
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f470871%2fexam-class-tikz-circled-choices-not-aligned-to-hanging-indent%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Unrelated:
label={center:#1}
isn't needed, because you have#1
in the node contents as well, so you end up printing the label twice, in the same place.– Torbjørn T.
7 hours ago
2
Probably not a good fix, but you could change
0em
to3pt
(or thereabouts).– Torbjørn T.
7 hours ago