TeX - LaTeX Asked on April 28, 2021
Is there a way to set the header contents depend on whether the solutions are printed or not ?
documentclass[headsepline]{scrartcl}
usepackage{xsim}
usepackage{scrlayer-scrpage}
cohead{Solutions are not printed}
%xsimsetup{solution/print}
%cohead{Solutions are printed}
begin{document}
begin{exercise}
body of exercise theexercise
end{exercise}
begin{solution}
solution of the exercise number theexercise
end{solution}
begin{exercise}
body of exercise theexercise
end{exercise}
begin{solution}
solution of the exercise number theexercise
end{solution}
begin{exercise}
body of exercise theexercise
end{exercise}
begin{solution}
solution of the exercise number theexercise
end{solution}
end{document}
You can set up a new if
flag, ifprintsolutions
(default false
). By declaring printsolutionstrue
, the header gets changed along with the solutions being printed.
newififprintsolutions
printsolutionstrue% COMMENT THIS LINE OR NOT
documentclass[headsepline]{scrartcl}
usepackage{xsim}
usepackage{scrlayer-scrpage}
ifprintsolutions
xsimsetup{solution/print}
cohead{Solutions are printed}
else
cohead{Solutions are not printed}
fi
begin{document}
begin{exercise}
body of exercise theexercise
end{exercise}
begin{solution}
solution of the exercise number theexercise
end{solution}
begin{exercise}
body of exercise theexercise
end{exercise}
begin{solution}
solution of the exercise number theexercise
end{solution}
begin{exercise}
body of exercise theexercise
end{exercise}
begin{solution}
solution of the exercise number theexercise
end{solution}
end{document}
Correct answer by Steven B. Segletes on April 28, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP