練習包 - 短答案和長答案

練習包 - 短答案和長答案

作為練習包的一部分,是否可以同時包含短答案和長答案?

例如,在以下範例中:數學書如何寫練習和答案 - 堆疊交換

是否有可能兩個部分都有一個簡短的答案部分,只包含答案,然後是一個完整的長答案部分?

微量元素:

\documentclass[11pt]{article}
\usepackage[margin=2cm,includefoot,bottom=2.55cm,top=2.025cm,headsep=0.5cm,footskip=0.65cm]{geometry}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multicol}

\usepackage{ifthen}
\newboolean{firstanswerofthesection}  

\usepackage{xcolor}
\definecolor{e}{RGB}{0,40,120}

\usepackage{chngcntr}
\usepackage{stackengine}

\usepackage{tasks}
\newlength{\longestlabel}
\settowidth{\longestlabel}{(m)}
\settasks{label-format=\color{e}, counter-format={(tsk[a])}, label-width=\longestlabel,
    item-indent=0pt, label-offset=2pt, column-sep={10pt}}

\usepackage[lastexercise,answerdelayed]{exercise}
\counterwithin{Exercise}{section}
\counterwithin{Answer}{section}
\renewcounter{Exercise}[section]
\newcommand{\QuestionNB}{\color{e}\bfseries\arabic{Question}.\,}
\renewcommand{\ExerciseName}{EXERCISE}
\renewcommand{\ExerciseHeader}{\noindent\def\stackalignment{l}% code from https://tex.stackexchange.com/a/195118/101651
    \stackunder[0pt]{\colorbox{e}{\textcolor{white}{\textbf{\large\ExerciseName\;\large\ExerciseHeaderNB}}}}{\textcolor{e}{\rule{\linewidth}{2pt}}}\medskip}
\renewcommand{\AnswerName}{Exercises}
\renewcommand{\AnswerHeader}{\ifthenelse{\boolean{firstanswerofthesection}}%
    {\bigskip\noindent\textcolor{e}{\textbf{SECTION \thesection}}\newline\newline%
        \noindent\bfseries\emph{\textcolor{e}{\AnswerName\ \ExerciseHeaderNB, page %
                \pageref{\AnswerRef}}}\smallskip}
    {\noindent\bfseries\emph{\textcolor{e}{\AnswerName\ \ExerciseHeaderNB, page \pageref{\AnswerRef}}}\smallskip}}
\setlength{\QuestionIndent}{16pt}

\begin{document}
    \section{First}

    \begin{Exercise}\label{EX11}
        \vspace{-\baselineskip}% <-- You don't need this line of code if there's some text here
        \Question In problem \ref{EX11-1-i}-\ref{EX11-1-iii}, determine whether the given differential equation is separable  
        \begin{tasks}(2)
            \task\label{EX11-1-i} $\frac{dy}{dx}-\sin{(x+y)}=0$     
            \task $\frac{dy}{dx}=4y^2-3y+1$ 
            \task\label{EX11-1-iii} $\frac{ds}{dt}=t\ln{(s^{2t})}+8t^2$ 
        \end{tasks}
        \Question In problem \ref{EX11-2-iv}-\ref{EX11-2-viii}, solve the equation 
        \begin{tasks}[resume=true](2)
            \task\label{EX11-2-iv} $\frac{dx}{dt}=3xt^2$
            \task $y^{-1}dy+ye^{\cos{x}}\sin{x}dx=0$
            \task $(x+xy^2)dx+ye^{\cos{x}}\sin{x}dx=0$
            \task\label{EX11-2-viii} $\frac{dy}{dt} = \frac{y}{t+1} + 4t^2 +  4t$, $\quad$ $y(1) = 10$
        \end{tasks}
    \end{Exercise}
    \setboolean{firstanswerofthesection}{true}
    \begin{multicols}{2}
        \begin{Answer}[ref={EX11}]
            \Question 
            \begin{tasks}(3)
                \task 45
                \task 32
                \task 32
            \end{tasks} 
            \Question 
            \begin{tasks}[resume=true]
                \task This is a solution of Ex 4
                \task This is a solution of Ex 5 
                \task This is a solution of Ex 6 
                \task This is a solution of Ex 7 
            \end{tasks} 
        \end{Answer}
    \end{multicols}
    \setboolean{firstanswerofthesection}{false}

    \begin{Exercise}\label{EX12}
        Another exercise. 
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use
        \Question If you don't need a horizontal list, you can simply use

    \end{Exercise}
    \begin{multicols}{2}
        \begin{Answer}[ref={EX12}]
            \Question This is a solution of Ex 1
        \end{Answer}
    \end{multicols}

    \section{Second}

    \begin{Exercise}\label{EX21}
        \vspace{-\baselineskip}% <-- You don't need this line of code if there's some text here
        \Question Eight systems of differential equations and five direction fields are given below.  Determine the system that corresponds to each direction field and sketch the solution curves that correspond to the initial conditions $(x_0, y_0) = (0,1)$ and $(x_0, y_0) = (1,-1)$.
        \begin{tasks}(3)
            \task $\begin{aligned}
            \frac{dx}{dt} & = -x \\     
            \frac{dy}{dt} & = y-1
            \end{aligned}$
            \task $\begin{aligned}
            \frac{dx}{dt} & = x^2 - 1 \\        
            \frac{dy}{dt} & = y
            \end{aligned}$
            \task $\begin{aligned}
            \frac{dx}{dt} & = x+2y \\
            \frac{dy}{dt} & = -y
            \end{aligned}$
            \task $\begin{aligned}
            \frac{dx}{dt} & = 2x \\
            \frac{dy}{dt} & =  y
            \end{aligned}$
            \task $\begin{aligned}
            \frac{dx}{dt} & = x \\
            \frac{dy}{dt}  & = 2y
            \end{aligned}$ 
            \task$\begin{aligned}
            \frac{dx}{dt} & = x-1 \\
            \frac{dy}{dt} & = -y
            \end{aligned}$
            \task$\begin{aligned}
            \frac{dx}{dt} & = x^2-1 \\
            \frac{dy}{dt} & = -y
            \end{aligned}$        
            \task $\begin{aligned}
            \frac{dx}{dt} & = x- 2y \\
            \frac{dy}{dt} & =  -y
            \end{aligned}$
        \end{tasks}
    \end{Exercise}
    \setboolean{firstanswerofthesection}{true}
    \begin{multicols}{2}
        \begin{Answer}[ref={EX21}]
            \Question 
            \begin{tasks}
                \task This is a solution of Ex 1
                \task This is a solution of Ex 2 
                \task This is a solution of Ex 3 
                \task This is a solution of Ex 4 
                \task This is a solution of Ex 5 
                \task This is a solution of Ex 6 
                \task This is a solution of Ex 7 
                \task This is a solution of Ex 8 
            \end{tasks}
        \end{Answer}
    \end{multicols}
    \setboolean{firstanswerofthesection}{false}
    \newpage        
    \begin{Exercise}\label{EX22}
        Since these are systems, maybe it's better to put the \verb|aligned| enviroment within  \verb|\left\{| and \verb|\right.|: 
        \Question Eight systems of differential equations and five direction fields are given below.  Determine the system that corresponds to each direction field and sketch the solution curves that correspond to the initial conditions $(x_0, y_0) = (0,1)$ and $(x_0, y_0) = (1,-1)$.
        \begin{tasks}(3)
            \task $\left\{\begin{aligned}
            \frac{dx}{dt} & = -x \\     
            \frac{dy}{dt} & = y-1
            \end{aligned}\right.$
            \task $\left\{\begin{aligned}
            \frac{dx}{dt} & = x^2 - 1 \\        
            \frac{dy}{dt} & = y
            \end{aligned}\right.$
            \task $\left\{\begin{aligned}
            \frac{dx}{dt} & = x+2y \\
            \frac{dy}{dt} & = -y
            \end{aligned}\right.$
            \task $\left\{\begin{aligned}
            \frac{dx}{dt} & = 2x \\
            \frac{dy}{dt} & =  y
            \end{aligned}\right.$
            \task $\left\{\begin{aligned}
            \frac{dx}{dt} & = x \\
            \frac{dy}{dt}  & = 2y
            \end{aligned}\right.$ 
            \task$\left\{\begin{aligned}
            \frac{dx}{dt} & = x-1 \\
            \frac{dy}{dt} & = -y
            \end{aligned}\right.$
            \task $\left\{\begin{aligned}
            \frac{dx}{dt} & = x^2-1 \\
            \frac{dy}{dt} & = -y
            \end{aligned}\right.$        
            \task $\left\{\begin{aligned}
            \frac{dx}{dt} & = x- 2y \\
            \frac{dy}{dt} & =  -y
            \end{aligned}\right.$
        \end{tasks}
    \end{Exercise}
    \begin{multicols}{2}
        \begin{Answer}[ref={EX22}]
            \Question 
            \begin{tasks}
                \task This is a solution of Ex 1
                \task This is a solution of Ex 2 
                \task This is a solution of Ex 3 
                \task This is a solution of Ex 4 
                \task This is a solution of Ex 5 
                \task This is a solution of Ex 6 
                \task This is a solution of Ex 7 
                \task This is a solution of Ex 8 
            \end{tasks}
        \end{Answer}
    \end{multicols}

    \newpage

    \section{Answer to all problems}

    \begin{multicols}{2}\raggedcolumns
        \shipoutAnswer
    \end{multicols}

\end{document}

相關內容