Section with answers created automaticallyHow to place all proofs automatically in appendix?setting section number, etc with counterDifferent numbering scheme per chapterCommon numbering with ntheoremthmbox with normal font and section numberingA simple section exercise sectionLaTeX beamer: pagenumbering appendixNumbering of newtheoremMixed section numbering accross subsectionsSidenotes with makeatletter/addtoreset begin with note 0, not 1Using answers with tasks

How to be diplomatic in refusing to write code that breaches the privacy of our users

Lay out the Carpet

Did Dumbledore lie to Harry about how long he had James Potter's invisibility cloak when he was examining it? If so, why?

Type int? vs type int

Are student evaluations of teaching assistants read by others in the faculty?

Implement the Thanos sorting algorithm

when is out of tune ok?

System.debug(JSON.Serialize(o)) Not longer shows full string

How to draw lines on a tikz-cd diagram

How can I kill an app using Terminal?

How do I find the solutions of the following equation?

Integer addition + constant, is it a group?

How many times can American Tourist re-enter UK in same 6 month period?

Do the temporary hit points from Reckless Abandon stack if I make multiple attacks on my turn?

Is there a problem with hiding "forgot password" until it's needed?

How long to clear the 'suck zone' of a turbofan after start is initiated?

How did Doctor Strange see the winning outcome in Avengers: Infinity War?

Why are there no referendums in the US?

Opposite of a diet

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Failed to fetch jessie backports repository

For a non-Jew, is there a punishment for not observing the 7 Noahide Laws?

How do we know the LHC results are robust?

Unreliable Magic - Is it worth it?



Section with answers created automatically


How to place all proofs automatically in appendix?setting section number, etc with counterDifferent numbering scheme per chapterCommon numbering with ntheoremthmbox with normal font and section numberingA simple section exercise sectionLaTeX beamer: pagenumbering appendixNumbering of newtheoremMixed section numbering accross subsectionsSidenotes with makeatletter/addtoreset begin with note 0, not 1Using answers with tasks













4















My question is quite similar to this one, but I think a slightly different approach is needed.



I have a document with a lot of exercices and I'd like to add aswers and hints to them in a certain section.



I don't want to do this manually, since, if I add an exercice, I'll have to make that the answers and hints keep the right order. Also, it's possible that not all exercices have an answer and a hint with them, so the numbering of answers and hints should be completely dependent of the numbering of exercices.



I.e, things like



1. Some hint for exercice 1
2. Some hint for exercice 2
4. Some hint for exercice 4
99. Some hint for exercice 99


should be possible.



For example:



documentclass[12pt,a4paper]article
usepackage[dutch]babel
usepackageamsthm

newtheoremexExercice
newtheoremans % Abbreviation for answer. No text needed because I just want numbers with the answers next to them.
newtheoremhi % Same here.

begindocument

sectionAlgebra
beginexWhat is $1+3$?endex
beginhiFirst consider $1+0$, $1+1$, $1+2$ and try to find a pattern.endhi
beginansIt's $4$!endans

sectionGrammar
setcounterex0 % So the counter is set to zero when a new section begins.

beginexThe first letter of the alphabet?endex
%No hint given here
beginansAendans

section*Answers
subsectionSection Algebra
%Answer should be here, but of course it isn't.

subsectionSection Grammar
%Same.

section*Hints
subsectionSection Algebra
%Hint here.

subsectionSection Grammar
% No hint because I didn't ask Latex to do so.

enddocument


So in fact I need some magicCommandThatPutsAnswersAndHintsSomewhereElse. If there's more then one answer in a section, I'd like them to be numbered like theorems.



As you may have noticed in the example, I want the answers and hints in a subsection that refers to their section.










share|improve this question



















  • 3





    I've done this for my book. I could show you the code (email me if you want) but basically: to output answers to somewhere else I used the answers package and to refer to things in the main text from the answers file I used the xr package. (Also, there is a counter giving the current exercise number and you can define the environment ans to start with textbfthat counter so your answer file is not just taking the answer numbers in ascending order.)

    – Jim Hefferon
    Aug 21 '13 at 11:31











  • @JimHefferon that sounds useful - and also suggests a possible solution for non-broken hyperref endnotes...

    – Joe Corneli
    Aug 21 '13 at 13:18











  • @JimHefferon thanks, I'll first try myself to fix it using answers and xr, and I'll report back when I have some results.

    – rabota
    Aug 21 '13 at 15:26











  • @JimHefferon I'm just wondering: what exactly did you need the xr package for? It seems like I can freely refer to labels in the main text from the answers. When I refer from the main text to the answers, it seems that the answers are simply numbered continuously, but the number that is displayed is the same as the corresponding exercise. For example if I number the answers per sections like 1.1, 1.2, 2.1, 2.2 the answers are 'labeled' 1, 2, 3, 4 while the displayed numbering is really 1.1, 1.2, 2.1, 2.2.

    – rabota
    Jun 25 '14 at 13:01











  • I allow for something more complicated that sequentially numbered exercises. For instance, I allow for the publication of a list of answers of the questions that are checkmarked. (I also number the exercises in sequence with the theorems.)

    – Jim Hefferon
    Jun 25 '14 at 19:54















4















My question is quite similar to this one, but I think a slightly different approach is needed.



I have a document with a lot of exercices and I'd like to add aswers and hints to them in a certain section.



I don't want to do this manually, since, if I add an exercice, I'll have to make that the answers and hints keep the right order. Also, it's possible that not all exercices have an answer and a hint with them, so the numbering of answers and hints should be completely dependent of the numbering of exercices.



I.e, things like



1. Some hint for exercice 1
2. Some hint for exercice 2
4. Some hint for exercice 4
99. Some hint for exercice 99


should be possible.



For example:



documentclass[12pt,a4paper]article
usepackage[dutch]babel
usepackageamsthm

newtheoremexExercice
newtheoremans % Abbreviation for answer. No text needed because I just want numbers with the answers next to them.
newtheoremhi % Same here.

begindocument

sectionAlgebra
beginexWhat is $1+3$?endex
beginhiFirst consider $1+0$, $1+1$, $1+2$ and try to find a pattern.endhi
beginansIt's $4$!endans

sectionGrammar
setcounterex0 % So the counter is set to zero when a new section begins.

beginexThe first letter of the alphabet?endex
%No hint given here
beginansAendans

section*Answers
subsectionSection Algebra
%Answer should be here, but of course it isn't.

subsectionSection Grammar
%Same.

section*Hints
subsectionSection Algebra
%Hint here.

subsectionSection Grammar
% No hint because I didn't ask Latex to do so.

enddocument


So in fact I need some magicCommandThatPutsAnswersAndHintsSomewhereElse. If there's more then one answer in a section, I'd like them to be numbered like theorems.



As you may have noticed in the example, I want the answers and hints in a subsection that refers to their section.










share|improve this question



















  • 3





    I've done this for my book. I could show you the code (email me if you want) but basically: to output answers to somewhere else I used the answers package and to refer to things in the main text from the answers file I used the xr package. (Also, there is a counter giving the current exercise number and you can define the environment ans to start with textbfthat counter so your answer file is not just taking the answer numbers in ascending order.)

    – Jim Hefferon
    Aug 21 '13 at 11:31











  • @JimHefferon that sounds useful - and also suggests a possible solution for non-broken hyperref endnotes...

    – Joe Corneli
    Aug 21 '13 at 13:18











  • @JimHefferon thanks, I'll first try myself to fix it using answers and xr, and I'll report back when I have some results.

    – rabota
    Aug 21 '13 at 15:26











  • @JimHefferon I'm just wondering: what exactly did you need the xr package for? It seems like I can freely refer to labels in the main text from the answers. When I refer from the main text to the answers, it seems that the answers are simply numbered continuously, but the number that is displayed is the same as the corresponding exercise. For example if I number the answers per sections like 1.1, 1.2, 2.1, 2.2 the answers are 'labeled' 1, 2, 3, 4 while the displayed numbering is really 1.1, 1.2, 2.1, 2.2.

    – rabota
    Jun 25 '14 at 13:01











  • I allow for something more complicated that sequentially numbered exercises. For instance, I allow for the publication of a list of answers of the questions that are checkmarked. (I also number the exercises in sequence with the theorems.)

    – Jim Hefferon
    Jun 25 '14 at 19:54













4












4








4


0






My question is quite similar to this one, but I think a slightly different approach is needed.



I have a document with a lot of exercices and I'd like to add aswers and hints to them in a certain section.



I don't want to do this manually, since, if I add an exercice, I'll have to make that the answers and hints keep the right order. Also, it's possible that not all exercices have an answer and a hint with them, so the numbering of answers and hints should be completely dependent of the numbering of exercices.



I.e, things like



1. Some hint for exercice 1
2. Some hint for exercice 2
4. Some hint for exercice 4
99. Some hint for exercice 99


should be possible.



For example:



documentclass[12pt,a4paper]article
usepackage[dutch]babel
usepackageamsthm

newtheoremexExercice
newtheoremans % Abbreviation for answer. No text needed because I just want numbers with the answers next to them.
newtheoremhi % Same here.

begindocument

sectionAlgebra
beginexWhat is $1+3$?endex
beginhiFirst consider $1+0$, $1+1$, $1+2$ and try to find a pattern.endhi
beginansIt's $4$!endans

sectionGrammar
setcounterex0 % So the counter is set to zero when a new section begins.

beginexThe first letter of the alphabet?endex
%No hint given here
beginansAendans

section*Answers
subsectionSection Algebra
%Answer should be here, but of course it isn't.

subsectionSection Grammar
%Same.

section*Hints
subsectionSection Algebra
%Hint here.

subsectionSection Grammar
% No hint because I didn't ask Latex to do so.

enddocument


So in fact I need some magicCommandThatPutsAnswersAndHintsSomewhereElse. If there's more then one answer in a section, I'd like them to be numbered like theorems.



As you may have noticed in the example, I want the answers and hints in a subsection that refers to their section.










share|improve this question
















My question is quite similar to this one, but I think a slightly different approach is needed.



I have a document with a lot of exercices and I'd like to add aswers and hints to them in a certain section.



I don't want to do this manually, since, if I add an exercice, I'll have to make that the answers and hints keep the right order. Also, it's possible that not all exercices have an answer and a hint with them, so the numbering of answers and hints should be completely dependent of the numbering of exercices.



I.e, things like



1. Some hint for exercice 1
2. Some hint for exercice 2
4. Some hint for exercice 4
99. Some hint for exercice 99


should be possible.



For example:



documentclass[12pt,a4paper]article
usepackage[dutch]babel
usepackageamsthm

newtheoremexExercice
newtheoremans % Abbreviation for answer. No text needed because I just want numbers with the answers next to them.
newtheoremhi % Same here.

begindocument

sectionAlgebra
beginexWhat is $1+3$?endex
beginhiFirst consider $1+0$, $1+1$, $1+2$ and try to find a pattern.endhi
beginansIt's $4$!endans

sectionGrammar
setcounterex0 % So the counter is set to zero when a new section begins.

beginexThe first letter of the alphabet?endex
%No hint given here
beginansAendans

section*Answers
subsectionSection Algebra
%Answer should be here, but of course it isn't.

subsectionSection Grammar
%Same.

section*Hints
subsectionSection Algebra
%Hint here.

subsectionSection Grammar
% No hint because I didn't ask Latex to do so.

enddocument


So in fact I need some magicCommandThatPutsAnswersAndHintsSomewhereElse. If there's more then one answer in a section, I'd like them to be numbered like theorems.



As you may have noticed in the example, I want the answers and hints in a subsection that refers to their section.







numbering theorems






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:34









Community

1




1










asked Aug 21 '13 at 10:48









rabotarabota

619715




619715







  • 3





    I've done this for my book. I could show you the code (email me if you want) but basically: to output answers to somewhere else I used the answers package and to refer to things in the main text from the answers file I used the xr package. (Also, there is a counter giving the current exercise number and you can define the environment ans to start with textbfthat counter so your answer file is not just taking the answer numbers in ascending order.)

    – Jim Hefferon
    Aug 21 '13 at 11:31











  • @JimHefferon that sounds useful - and also suggests a possible solution for non-broken hyperref endnotes...

    – Joe Corneli
    Aug 21 '13 at 13:18











  • @JimHefferon thanks, I'll first try myself to fix it using answers and xr, and I'll report back when I have some results.

    – rabota
    Aug 21 '13 at 15:26











  • @JimHefferon I'm just wondering: what exactly did you need the xr package for? It seems like I can freely refer to labels in the main text from the answers. When I refer from the main text to the answers, it seems that the answers are simply numbered continuously, but the number that is displayed is the same as the corresponding exercise. For example if I number the answers per sections like 1.1, 1.2, 2.1, 2.2 the answers are 'labeled' 1, 2, 3, 4 while the displayed numbering is really 1.1, 1.2, 2.1, 2.2.

    – rabota
    Jun 25 '14 at 13:01











  • I allow for something more complicated that sequentially numbered exercises. For instance, I allow for the publication of a list of answers of the questions that are checkmarked. (I also number the exercises in sequence with the theorems.)

    – Jim Hefferon
    Jun 25 '14 at 19:54












  • 3





    I've done this for my book. I could show you the code (email me if you want) but basically: to output answers to somewhere else I used the answers package and to refer to things in the main text from the answers file I used the xr package. (Also, there is a counter giving the current exercise number and you can define the environment ans to start with textbfthat counter so your answer file is not just taking the answer numbers in ascending order.)

    – Jim Hefferon
    Aug 21 '13 at 11:31











  • @JimHefferon that sounds useful - and also suggests a possible solution for non-broken hyperref endnotes...

    – Joe Corneli
    Aug 21 '13 at 13:18











  • @JimHefferon thanks, I'll first try myself to fix it using answers and xr, and I'll report back when I have some results.

    – rabota
    Aug 21 '13 at 15:26











  • @JimHefferon I'm just wondering: what exactly did you need the xr package for? It seems like I can freely refer to labels in the main text from the answers. When I refer from the main text to the answers, it seems that the answers are simply numbered continuously, but the number that is displayed is the same as the corresponding exercise. For example if I number the answers per sections like 1.1, 1.2, 2.1, 2.2 the answers are 'labeled' 1, 2, 3, 4 while the displayed numbering is really 1.1, 1.2, 2.1, 2.2.

    – rabota
    Jun 25 '14 at 13:01











  • I allow for something more complicated that sequentially numbered exercises. For instance, I allow for the publication of a list of answers of the questions that are checkmarked. (I also number the exercises in sequence with the theorems.)

    – Jim Hefferon
    Jun 25 '14 at 19:54







3




3





I've done this for my book. I could show you the code (email me if you want) but basically: to output answers to somewhere else I used the answers package and to refer to things in the main text from the answers file I used the xr package. (Also, there is a counter giving the current exercise number and you can define the environment ans to start with textbfthat counter so your answer file is not just taking the answer numbers in ascending order.)

– Jim Hefferon
Aug 21 '13 at 11:31





I've done this for my book. I could show you the code (email me if you want) but basically: to output answers to somewhere else I used the answers package and to refer to things in the main text from the answers file I used the xr package. (Also, there is a counter giving the current exercise number and you can define the environment ans to start with textbfthat counter so your answer file is not just taking the answer numbers in ascending order.)

– Jim Hefferon
Aug 21 '13 at 11:31













@JimHefferon that sounds useful - and also suggests a possible solution for non-broken hyperref endnotes...

– Joe Corneli
Aug 21 '13 at 13:18





@JimHefferon that sounds useful - and also suggests a possible solution for non-broken hyperref endnotes...

– Joe Corneli
Aug 21 '13 at 13:18













@JimHefferon thanks, I'll first try myself to fix it using answers and xr, and I'll report back when I have some results.

– rabota
Aug 21 '13 at 15:26





@JimHefferon thanks, I'll first try myself to fix it using answers and xr, and I'll report back when I have some results.

– rabota
Aug 21 '13 at 15:26













@JimHefferon I'm just wondering: what exactly did you need the xr package for? It seems like I can freely refer to labels in the main text from the answers. When I refer from the main text to the answers, it seems that the answers are simply numbered continuously, but the number that is displayed is the same as the corresponding exercise. For example if I number the answers per sections like 1.1, 1.2, 2.1, 2.2 the answers are 'labeled' 1, 2, 3, 4 while the displayed numbering is really 1.1, 1.2, 2.1, 2.2.

– rabota
Jun 25 '14 at 13:01





@JimHefferon I'm just wondering: what exactly did you need the xr package for? It seems like I can freely refer to labels in the main text from the answers. When I refer from the main text to the answers, it seems that the answers are simply numbered continuously, but the number that is displayed is the same as the corresponding exercise. For example if I number the answers per sections like 1.1, 1.2, 2.1, 2.2 the answers are 'labeled' 1, 2, 3, 4 while the displayed numbering is really 1.1, 1.2, 2.1, 2.2.

– rabota
Jun 25 '14 at 13:01













I allow for something more complicated that sequentially numbered exercises. For instance, I allow for the publication of a list of answers of the questions that are checkmarked. (I also number the exercises in sequence with the theorems.)

– Jim Hefferon
Jun 25 '14 at 19:54





I allow for something more complicated that sequentially numbered exercises. For instance, I allow for the publication of a list of answers of the questions that are checkmarked. (I also number the exercises in sequence with the theorems.)

– Jim Hefferon
Jun 25 '14 at 19:54










1 Answer
1






active

oldest

votes


















0














I face the same issue as you do. I create my exercises lists with two features: I can print it with the answers (for students) or with the solutions (for me; in this case, the answers disappear).



I will show you here pieces of my code (it is too huge and, believe me, is not worth to paste it as a whole here). So, let's start...



I created the commands problem where I state the problem and answer where I store the answer to each problem, as well as the environment solution where I store the solution to the problem (with the argument, I can set the number of columns to arrange the solution in order to make it more compact):



%-> Defining COUNTERS:
newcounterproblem

%-> Defining the numbered environment for QUESTIONS, TESTS, EXERCISES, PROBLEMS, and CHALLENGES:
newcommandproblem%
parbigskip
refstepcounterproblem
noindenttextbfptype mnumber.theproblem


%-> Defining the environment for the ANSWERS to QUESTIONS
newcommandanswer[1]%
letthefootnoterelax %... suppresses the footnote numbering
footnotetextbfptype mnumber.theproblem- #1%


newififcols

%-> Defining the environment for the SOLUTIONS:
newenvironmentsolution[1]%
setlengthparindent0cm
vspace-2.5mm
textbffootnotesize Solution:par
vspace-3mm
footnotesize
ifnum #1 > 1
colstrue
beginmulticols#1
fi
%
ifcols
endmulticols
fi
colsfalse



Lattar on, I create the Boolean ifshowans for which showanstrue can be commented out whenever I want to hide the solution and show the answer (in case I want to prin material for the students). Otherwise, it will print the solution and hide the answers:



%-> Defining the MATERIAL TYPE:
newififshowans
showanstrue
ifshowans
renewcommandanswer[1]
else
letsolutioncomment
letendsolutionendcomment
fi


Up to here, you can observe that in my case, I preferred to show the solutions in the footnotes. Since you want to display them at the end of the document, you should modify the answer command to something like this:



%-> Defining the environment for the ANSWERS to QUESTIONS
newcommandanswer[1]%
lettheendnoterelax %... suppresses the endnote numbering
endnotetextbfptype mnumber.theproblem- #1%



I hope this helps you.





share






















    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%2f129364%2fsection-with-answers-created-automatically%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









    0














    I face the same issue as you do. I create my exercises lists with two features: I can print it with the answers (for students) or with the solutions (for me; in this case, the answers disappear).



    I will show you here pieces of my code (it is too huge and, believe me, is not worth to paste it as a whole here). So, let's start...



    I created the commands problem where I state the problem and answer where I store the answer to each problem, as well as the environment solution where I store the solution to the problem (with the argument, I can set the number of columns to arrange the solution in order to make it more compact):



    %-> Defining COUNTERS:
    newcounterproblem

    %-> Defining the numbered environment for QUESTIONS, TESTS, EXERCISES, PROBLEMS, and CHALLENGES:
    newcommandproblem%
    parbigskip
    refstepcounterproblem
    noindenttextbfptype mnumber.theproblem


    %-> Defining the environment for the ANSWERS to QUESTIONS
    newcommandanswer[1]%
    letthefootnoterelax %... suppresses the footnote numbering
    footnotetextbfptype mnumber.theproblem- #1%


    newififcols

    %-> Defining the environment for the SOLUTIONS:
    newenvironmentsolution[1]%
    setlengthparindent0cm
    vspace-2.5mm
    textbffootnotesize Solution:par
    vspace-3mm
    footnotesize
    ifnum #1 > 1
    colstrue
    beginmulticols#1
    fi
    %
    ifcols
    endmulticols
    fi
    colsfalse



    Lattar on, I create the Boolean ifshowans for which showanstrue can be commented out whenever I want to hide the solution and show the answer (in case I want to prin material for the students). Otherwise, it will print the solution and hide the answers:



    %-> Defining the MATERIAL TYPE:
    newififshowans
    showanstrue
    ifshowans
    renewcommandanswer[1]
    else
    letsolutioncomment
    letendsolutionendcomment
    fi


    Up to here, you can observe that in my case, I preferred to show the solutions in the footnotes. Since you want to display them at the end of the document, you should modify the answer command to something like this:



    %-> Defining the environment for the ANSWERS to QUESTIONS
    newcommandanswer[1]%
    lettheendnoterelax %... suppresses the endnote numbering
    endnotetextbfptype mnumber.theproblem- #1%



    I hope this helps you.





    share



























      0














      I face the same issue as you do. I create my exercises lists with two features: I can print it with the answers (for students) or with the solutions (for me; in this case, the answers disappear).



      I will show you here pieces of my code (it is too huge and, believe me, is not worth to paste it as a whole here). So, let's start...



      I created the commands problem where I state the problem and answer where I store the answer to each problem, as well as the environment solution where I store the solution to the problem (with the argument, I can set the number of columns to arrange the solution in order to make it more compact):



      %-> Defining COUNTERS:
      newcounterproblem

      %-> Defining the numbered environment for QUESTIONS, TESTS, EXERCISES, PROBLEMS, and CHALLENGES:
      newcommandproblem%
      parbigskip
      refstepcounterproblem
      noindenttextbfptype mnumber.theproblem


      %-> Defining the environment for the ANSWERS to QUESTIONS
      newcommandanswer[1]%
      letthefootnoterelax %... suppresses the footnote numbering
      footnotetextbfptype mnumber.theproblem- #1%


      newififcols

      %-> Defining the environment for the SOLUTIONS:
      newenvironmentsolution[1]%
      setlengthparindent0cm
      vspace-2.5mm
      textbffootnotesize Solution:par
      vspace-3mm
      footnotesize
      ifnum #1 > 1
      colstrue
      beginmulticols#1
      fi
      %
      ifcols
      endmulticols
      fi
      colsfalse



      Lattar on, I create the Boolean ifshowans for which showanstrue can be commented out whenever I want to hide the solution and show the answer (in case I want to prin material for the students). Otherwise, it will print the solution and hide the answers:



      %-> Defining the MATERIAL TYPE:
      newififshowans
      showanstrue
      ifshowans
      renewcommandanswer[1]
      else
      letsolutioncomment
      letendsolutionendcomment
      fi


      Up to here, you can observe that in my case, I preferred to show the solutions in the footnotes. Since you want to display them at the end of the document, you should modify the answer command to something like this:



      %-> Defining the environment for the ANSWERS to QUESTIONS
      newcommandanswer[1]%
      lettheendnoterelax %... suppresses the endnote numbering
      endnotetextbfptype mnumber.theproblem- #1%



      I hope this helps you.





      share

























        0












        0








        0







        I face the same issue as you do. I create my exercises lists with two features: I can print it with the answers (for students) or with the solutions (for me; in this case, the answers disappear).



        I will show you here pieces of my code (it is too huge and, believe me, is not worth to paste it as a whole here). So, let's start...



        I created the commands problem where I state the problem and answer where I store the answer to each problem, as well as the environment solution where I store the solution to the problem (with the argument, I can set the number of columns to arrange the solution in order to make it more compact):



        %-> Defining COUNTERS:
        newcounterproblem

        %-> Defining the numbered environment for QUESTIONS, TESTS, EXERCISES, PROBLEMS, and CHALLENGES:
        newcommandproblem%
        parbigskip
        refstepcounterproblem
        noindenttextbfptype mnumber.theproblem


        %-> Defining the environment for the ANSWERS to QUESTIONS
        newcommandanswer[1]%
        letthefootnoterelax %... suppresses the footnote numbering
        footnotetextbfptype mnumber.theproblem- #1%


        newififcols

        %-> Defining the environment for the SOLUTIONS:
        newenvironmentsolution[1]%
        setlengthparindent0cm
        vspace-2.5mm
        textbffootnotesize Solution:par
        vspace-3mm
        footnotesize
        ifnum #1 > 1
        colstrue
        beginmulticols#1
        fi
        %
        ifcols
        endmulticols
        fi
        colsfalse



        Lattar on, I create the Boolean ifshowans for which showanstrue can be commented out whenever I want to hide the solution and show the answer (in case I want to prin material for the students). Otherwise, it will print the solution and hide the answers:



        %-> Defining the MATERIAL TYPE:
        newififshowans
        showanstrue
        ifshowans
        renewcommandanswer[1]
        else
        letsolutioncomment
        letendsolutionendcomment
        fi


        Up to here, you can observe that in my case, I preferred to show the solutions in the footnotes. Since you want to display them at the end of the document, you should modify the answer command to something like this:



        %-> Defining the environment for the ANSWERS to QUESTIONS
        newcommandanswer[1]%
        lettheendnoterelax %... suppresses the endnote numbering
        endnotetextbfptype mnumber.theproblem- #1%



        I hope this helps you.





        share













        I face the same issue as you do. I create my exercises lists with two features: I can print it with the answers (for students) or with the solutions (for me; in this case, the answers disappear).



        I will show you here pieces of my code (it is too huge and, believe me, is not worth to paste it as a whole here). So, let's start...



        I created the commands problem where I state the problem and answer where I store the answer to each problem, as well as the environment solution where I store the solution to the problem (with the argument, I can set the number of columns to arrange the solution in order to make it more compact):



        %-> Defining COUNTERS:
        newcounterproblem

        %-> Defining the numbered environment for QUESTIONS, TESTS, EXERCISES, PROBLEMS, and CHALLENGES:
        newcommandproblem%
        parbigskip
        refstepcounterproblem
        noindenttextbfptype mnumber.theproblem


        %-> Defining the environment for the ANSWERS to QUESTIONS
        newcommandanswer[1]%
        letthefootnoterelax %... suppresses the footnote numbering
        footnotetextbfptype mnumber.theproblem- #1%


        newififcols

        %-> Defining the environment for the SOLUTIONS:
        newenvironmentsolution[1]%
        setlengthparindent0cm
        vspace-2.5mm
        textbffootnotesize Solution:par
        vspace-3mm
        footnotesize
        ifnum #1 > 1
        colstrue
        beginmulticols#1
        fi
        %
        ifcols
        endmulticols
        fi
        colsfalse



        Lattar on, I create the Boolean ifshowans for which showanstrue can be commented out whenever I want to hide the solution and show the answer (in case I want to prin material for the students). Otherwise, it will print the solution and hide the answers:



        %-> Defining the MATERIAL TYPE:
        newififshowans
        showanstrue
        ifshowans
        renewcommandanswer[1]
        else
        letsolutioncomment
        letendsolutionendcomment
        fi


        Up to here, you can observe that in my case, I preferred to show the solutions in the footnotes. Since you want to display them at the end of the document, you should modify the answer command to something like this:



        %-> Defining the environment for the ANSWERS to QUESTIONS
        newcommandanswer[1]%
        lettheendnoterelax %... suppresses the endnote numbering
        endnotetextbfptype mnumber.theproblem- #1%



        I hope this helps you.






        share











        share


        share










        answered 6 mins ago









        BrasilBrasil

        4142412




        4142412



























            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%2f129364%2fsection-with-answers-created-automatically%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

            How should I use the fbox command correctly to avoid producing a Bad Box message?How to put a long piece of text in a box?How to specify height and width of fboxIs there an arrayrulecolor-like command to change the rule color of fbox?What is the command to highlight bad boxes in pdf?Why does fbox sometimes place the box *over* the graphic image?how to put the text in the boxHow to create command for a box where text inside the box can automatically adjust?how can I make an fbox like command with certain color, shape and width of border?how to use fbox in align modeFbox increase the spacing between the box and it content (inner margin)how to change the box height of an equationWhat is the use of the hbox in a newcommand command?

            Doxepinum Nexus interni Notae | Tabula navigationis3158DB01142WHOa682390"Structural Analysis of the Histamine H1 Receptor""Transdermal and Topical Drug Administration in the Treatment of Pain""Antidepressants as antipruritic agents: A review"

            inputenc: Unicode character … not set up for use with LaTeX The Next CEO of Stack OverflowEntering Unicode characters in LaTeXHow to solve the `Package inputenc Error: Unicode char not set up for use with LaTeX` problem?solve “Unicode char is not set up for use with LaTeX” without special handling of every new interesting UTF-8 characterPackage inputenc Error: Unicode character ² (U+B2)(inputenc) not set up for use with LaTeX. acroI2C[I²C]package inputenc error unicode char (u + 190) not set up for use with latexPackage inputenc Error: Unicode char u8:′ not set up for use with LaTeX. 3′inputenc Error: Unicode char u8: not set up for use with LaTeX with G-BriefPackage Inputenc Error: Unicode char u8: not set up for use with LaTeXPackage inputenc Error: Unicode char ́ (U+301)(inputenc) not set up for use with LaTeX. includePackage inputenc Error: Unicode char ̂ (U+302)(inputenc) not set up for use with LaTeX. … $widehatleft (OA,AA' right )$Package inputenc Error: Unicode char â„¡ (U+2121)(inputenc) not set up for use with LaTeX. printbibliography[heading=bibintoc]Package inputenc Error: Unicode char − (U+2212)(inputenc) not set up for use with LaTeXPackage inputenc Error: Unicode character α (U+3B1) not set up for use with LaTeXPackage inputenc Error: Unicode characterError: ! Package inputenc Error: Unicode char ⊘ (U+2298)(inputenc) not set up for use with LaTeX