Как получить Пример и решение как в стиле с границами прикрепленного файла jpg.
documentclass {book} usepackage {graphicx, amssymb, amsmath} usepackage {упражнение, chngcntr} counterwithin {Exercise} {chapter} counterwithin {Answer} {chapter} refreshcounter {Exercise} [chapter] refreshcommand { theExercise} { thechapter. арабский {Exercise}} begin {document} begin {Exercise} Докажите, что $ frac {1} {2} Delta (f_ {ij} f ^ {ij}) = nabla ^ {k} f ^ {ij } + f ^ {ij} f ^ {k} [2 nabla_ {i} R_ {jk} - nabla_ {k} R_ {ij}] $ end {Exercise} begin {Answer} Ответ 2.2 end { Ответ} end {document}
Я создал новую среду Example
, которая помещает Выполните
одно упражнение в tcolorbox
.
documentclass {book} usepackage {graphicx, amssymb, amsmath} usepackage [ lastexercise] {упражнение} usepackage {chngcntr} usepackage {xcolor} usepackage {tcolorbox} tcbset {arc = 0mm, boxrule = 1pt, colback = white, colframe = cyan, leftrule = 3mm} counterwithin {Exercise} {chapter } counterwithin {Ответ} {глава} Renewcounte r {Exercise} [глава] Renewcommand { theExercise} { thechapter. arabic {Exercise}} Renewcommand { AnswerHeader} { medskip noindent textcolor {red} { textbf {SOLUTION}} ;} Renewcommand { ExerciseName} {EXAMPLE} refreshcommand { ExerciseHeader} { noindent textbf { ExerciseName ; ExerciseHeaderNB}} newenvironment {Example} { begin {tcolorbox} begin {Exercise}} { end {Exercise } end {tcolorbox}} setlength { ExerciseSkipBefore} {0pt} setlength { AnswerSkipAfter} { baselineskip} begin {document} chapter {Мой первый набор упражнений} begin {Example} Докажите, что $ frac {1} {2} Delta (f_ {ij} f ^ {ij}) = nabla ^ {k} f ^ {ij} + f ^ {ij} f ^ {k} [2 nabla_ {i} R_ {jk} - nabla_ {k} R_ {ij}] $ end {Example} begin {Answer} From dots end {Answer} begin {Example} Докажите, что Паулиньо умен. end {Пример} begin {Answer} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. end {Answer} begin {Example} Докажите, что Паулиньо умен. end {Пример} begin {Answer} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. end {Answer} chapter {Мой второй комплекс упражнений} begin {Example} Докажи, что Паулиньо умен. end {Пример} begin {Answer} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. end {Answer} begin {Example} Докажите, что Паулиньо умен. end {Пример} begin {Answer} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. end {Answer} end {document}
Надеюсь, это именно тот результат, который вы ищете:
Использование пакета xsim
с tcolorbox
(вопросы и ответы, украденные из ответа CarLaTeX):
documentclass {article} usepackage {xsim, tcolorbox, needspace} xsimsetup {упражнение/внутри = раздел, упражнение/the-counter = секция. арабский {упражнение}, упражнение/шаблон = голубой прямоугольник, упражнение/имя = пример, решение/шаблон = красный, решение/печать = истина} DeclareExerciseEnvironmentTemplate {голубой-бокс} {% begin {tcolorbox} [arc = 0 мм , boxrule = 1pt, colback = white, colframe = cyan, leftrule = 3 мм] textf {% MakeUppercase {% XSIMmixedcase { GetExerciseName} ~ GetExerciseProperty {counter}%}%}% GetExercisePropertyT {subtitle} { textit {# 1}}% quad} { end {tcolorbox}} DeclareExerciseEnvironmentTemplate {red} {% par Needspace * {2 baselineskip} noindent textf { textcolor {red} { MakeUppercase { XSIMmixedcase { GetExerciseName}}}}% quad} { par bigskip} begin {document} section {Мой первый набор упражнений} begin {training} Докажите, что $ frac {1} {2} Delta (f_ {ij} f ^ {ij}) = nabla ^ {k} f ^ {ij} + f ^ {ij} f ^ {k} [2 nabla_ {i} R_ {jk} - nabla_ {k} R_ {ij}] $ end {упражнение} begin {solution} From dots end {solution} begin {упражнение} Докажите, что Паулиньо умен. end {упражнение} begin {solution} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. End {solution} begin {training} Докажи, что Паулиньо умен. End {упражнение} begin {solution} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. End {solution} section {Мой второй комплекс упражнений} begin {упражнение} Докажи, что Паулиньо умен. End {упражнение} begin {solution} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. End {solution} begin {training} Докажи, что Паулиньо умен. End {упражнение} begin {solution} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. End {solution} end {document}
Использование пакета xsim
с tcolorbox
(вопросы и ответы украдены из ответа CarLaTeX):
documentclass {article} usepackage {xsim, tcolorbox, needspace} xsimsetup {упражнение/внутри = раздел, упражнение/the-counter = thesection . arabic {упражнение}, упражнение/шаблон = голубой прямоугольник, упражнение/имя = Пример, решение/шаблон = красный, решение/печать = истина} DeclareExerciseEnvironmentTemplate {голубой-ящик} {% begin {tcolorbox} [arc = 0 мм, boxrule = 1pt, colback = white, colframe = cyan, leftrule = 3mm] textf {% MakeUppercase {% XSIMmixedcase { GetExerciseName} ~ GetExerciseProperty {counter}%}%}% GetExercisePropertyT {subtitle} { textit {# 1}}% quad} { end {tcolorbox}} DeclareExerciseEnvironmentTemplate {красный} {% par Needspace * {2 baseline skip} noindent textf { textcolor {red} { MakeUppercase { XSIMmixedcase { GetExerciseName}}}}% quad} { par bigskip} begin {document} section {Мой первый набор упражнений} begin {упражнение} Докажите, что $ frac {1} {2} Delta (f_ {ij} f ^ {ij}) = nabla ^ {k} f ^ {ij} + f ^ {ij} f ^ {k } [2 nabla_ {i} R_ {jk} - nabla_ {k} R_ {ij}] $ end {упражнение} begin {solution} From dots end {solution} begin {упражнение} Докажите, что Paulinho умны. end {упражнение} begin {solution} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. end {solution} begin {упражнение} Докажите, что Паулиньо умен. end {упражнение} begin {solution} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. End {solution} section {Мой второй комплекс упражнений} begin {упражнение} Докажи, что Паулиньо умен. End {упражнение} begin {solution} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. End {solution} begin {training} Докажи, что Паулиньо умен. End {упражнение} begin {solution} Все утки умны. Паулиньо - утка. Поэтому Паулиньо умен. End {solution} end {document}