Exam class: TikZ-circled choices not aligned to hanging indent












4















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:




  1. Good way to make textcircled numbers?

  2. Using circled numbers for answer choices in exam document class

  3. How can I draw circled integers with the same size by TikZ?

  4. 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}


MWE



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?










share|improve this question




















  • 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 to 3pt (or thereabouts).

    – Torbjørn T.
    7 hours ago
















4















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:




  1. Good way to make textcircled numbers?

  2. Using circled numbers for answer choices in exam document class

  3. How can I draw circled integers with the same size by TikZ?

  4. 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}


MWE



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?










share|improve this question




















  • 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 to 3pt (or thereabouts).

    – Torbjørn T.
    7 hours ago














4












4








4


0






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:




  1. Good way to make textcircled numbers?

  2. Using circled numbers for answer choices in exam document class

  3. How can I draw circled integers with the same size by TikZ?

  4. 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}


MWE



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?










share|improve this question
















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:




  1. Good way to make textcircled numbers?

  2. Using circled numbers for answer choices in exam document class

  3. How can I draw circled integers with the same size by TikZ?

  4. 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}


MWE



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 change 0em to 3pt (or thereabouts).

    – Torbjørn T.
    7 hours ago














  • 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 to 3pt (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










1 Answer
1






active

oldest

votes


















6














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}


enter image description here






share|improve this answer

























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    6














    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}


    enter image description here






    share|improve this answer






























      6














      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}


      enter image description here






      share|improve this answer




























        6












        6








        6







        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}


        enter image description here






        share|improve this answer















        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}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 6 hours ago

























        answered 7 hours ago









        marmotmarmot

        92.7k4109203




        92.7k4109203






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            SQL Server 17 - Attemping to backup to remote NAS but Access is denied

            Always On Availability groups resolving state after failover - Remote harden of transaction...

            Restoring from pg_dump with foreign key constraints