TeX - LaTeX Asked on February 24, 2021
Following-up this answer, I would like to
1- have a key/option for the package that sets the default width. For example, something like usepackage[default-width = outer]{examwsolns}
2- understand what userdefinedwidth = textwidth
means as an option passed to the mdframed environment of the wide solution. Shouldn’t it mean that the default width is the textwidth
? If yes, why the width of the solutions of the question and the part doesn’t respect it?
P.S. the definition of the package examwsolns
can be found here.
documentclass[answers]{exam}
usepackage[framemethod=tikz]{mdframed}
usepackage{examwsolns}
usepackage{xcolor}
usepackage{lipsum}
usepackage{tikz}
% Default additional arguments to pass to the 'mdframed' environment
examwsolnsSetMdFramedDefaultArgs{
skipabove = baselineskip,
innertopmargin = baselineskip,
innerbottommargin = baselineskip,
userdefinedwidth = textwidth
}
begin{document}
Here is a full line:
parnoindenthrulefill
begin{wsolution}
Autodetected outer level.
end{wsolution}
begin{questions}
question A question.
begin{wsolution}
Autodetected question level.
end{wsolution}
begin{parts}
part A part
begin{wsolution}[][innertopmargin = 2baselineskip,
innerbottommargin = 2baselineskip,
backgroundcolor=gray!40,
userdefinedwidth = textwidth]
Autodetected part level.
end{wsolution}
end{parts}
end{questions}
end{document}
For your first question, examwsolns
version 0.4 and later provide the default-level
package option. Its initial value is current
, which causes wsolution
environments to autodetect the current question level, then indent and choose the width accordingly (same behavior as when the option isn't been used). You can pass any of the following values to this option: current
, outer
, question
, part
, subpart
, subsubpart
. For instance, usepackage[default-level=outer]{examwsolns}
.
The option value may also be changed mid-document, e.g.: examwsolnsSetup{default-level=part}
(this respects TeX's grouping rules). You may use an integer between 0 and 4 in the first argument of wsolution
if you want override the default level just for one environment. To manually choose the level for a bunch of consecutive wsolution
environments, it's easier to do examwsolnsSetup{default-level=...}
inside a group that contains the environments:
{%
examwsolnsSetup{default-level=...}%
begin{wsolution} ... end{wsolution}
...
begin{wsolution} ... end{wsolution}
}
Concerning your second question, when you specify userdefinedwidth
, you impose the width of the box, from left border to right border. This does not include indentation, which depends on the question level. Your example appears to work as designed (but your boxes go beyond the right margin due to indentation). Here is a trivial variation with userdefinedwidth = 0.5textwidth
, to make the effect more visible. The last enviromnent isn't affected because it explicitly specifies its own options for the mdframed
environment (the second argument of wsolution
overrides whatever you gave to examwsolnsSetMdFramedDefaultArgs
).
documentclass[answers]{exam}
usepackage[framemethod=tikz]{mdframed}
usepackage{examwsolns}
% Default additional arguments to pass to the 'mdframed' environment
examwsolnsSetMdFramedDefaultArgs{
skipabove = baselineskip,
innertopmargin = baselineskip,
innerbottommargin = baselineskip,
userdefinedwidth = 0.5textwidth
}
begin{document}
Here is a full line:
parnoindenthrulefill
begin{wsolution}
Autodetected outer level.
end{wsolution}
begin{questions}
question A question.
begin{wsolution}
Autodetected question level.
end{wsolution}
begin{parts}
part A part
begin{wsolution}[][innertopmargin = 2baselineskip,
innerbottommargin = 2baselineskip,
backgroundcolor=gray!40]
Autodetected part level.
end{wsolution}
end{parts}
end{questions}
end{document}
Correct answer by frougon on February 24, 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