lamport pf2.sty and hide/show parts of nested enumerate environment
up vote
0
down vote
favorite
I am currently getting acquainted with Leslie Lamports pf2.sty
(http://lamport.azurewebsites.net/latex/latex.html).
Which unfortunately is not on CTAN.
It intents to encourage a certain proof style, which Lamport calls
hierarchical proof.
A proof looks then a lot as nested enumerate environments
The pf2.sty package itself is not so comfortable and most of its
features can be achieved by using the enumitem package.
However there is one useful feature which I don't know how to implement
in vanilla latex, namely hide/show parts of the nested proofs.
Here is an example (presuming you have pf.sty
documentclass[12pt]{article}
usepackage{pf2}
begin{document}
pfhidelevel{1}
begin{proof}
step{item:test-lamport2:1b}{Text of step 1.}
begin{proof}
step{label-1.1}{Text of substep 1}
begin{proof}
pf Paragraph proof using results in stepref{label-1.1} .~qed
end{proof}
step{label-2.1}{Text of substep 2}
end{proof}
step{label-2.2}{Text of step 2}
end{proof}
end{document}
so only text of step 1 and 2 are displayed after compiling, if I chose
pfhidelevel{2}, then also the next level will be shown etc.
Now to my enumitem solution
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
begin{document}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
Uwe Brauer
enumerate enumitem
add a comment |
up vote
0
down vote
favorite
I am currently getting acquainted with Leslie Lamports pf2.sty
(http://lamport.azurewebsites.net/latex/latex.html).
Which unfortunately is not on CTAN.
It intents to encourage a certain proof style, which Lamport calls
hierarchical proof.
A proof looks then a lot as nested enumerate environments
The pf2.sty package itself is not so comfortable and most of its
features can be achieved by using the enumitem package.
However there is one useful feature which I don't know how to implement
in vanilla latex, namely hide/show parts of the nested proofs.
Here is an example (presuming you have pf.sty
documentclass[12pt]{article}
usepackage{pf2}
begin{document}
pfhidelevel{1}
begin{proof}
step{item:test-lamport2:1b}{Text of step 1.}
begin{proof}
step{label-1.1}{Text of substep 1}
begin{proof}
pf Paragraph proof using results in stepref{label-1.1} .~qed
end{proof}
step{label-2.1}{Text of substep 2}
end{proof}
step{label-2.2}{Text of step 2}
end{proof}
end{document}
so only text of step 1 and 2 are displayed after compiling, if I chose
pfhidelevel{2}, then also the next level will be shown etc.
Now to my enumitem solution
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
begin{document}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
Uwe Brauer
enumerate enumitem
the implementation ofpfhidelevel
is pretty simple but it would be easier to answer if you provided a full document using pf2 so it can be tested and a second document with your proposedenumitem
markup (but without the hiding) so we just need to test adding the hide level feature.
– David Carlisle
Jul 26 at 20:18
I seem unable to add the required text. It will be malformed. any advice?
– Uwe Brauer
Jul 26 at 20:34
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am currently getting acquainted with Leslie Lamports pf2.sty
(http://lamport.azurewebsites.net/latex/latex.html).
Which unfortunately is not on CTAN.
It intents to encourage a certain proof style, which Lamport calls
hierarchical proof.
A proof looks then a lot as nested enumerate environments
The pf2.sty package itself is not so comfortable and most of its
features can be achieved by using the enumitem package.
However there is one useful feature which I don't know how to implement
in vanilla latex, namely hide/show parts of the nested proofs.
Here is an example (presuming you have pf.sty
documentclass[12pt]{article}
usepackage{pf2}
begin{document}
pfhidelevel{1}
begin{proof}
step{item:test-lamport2:1b}{Text of step 1.}
begin{proof}
step{label-1.1}{Text of substep 1}
begin{proof}
pf Paragraph proof using results in stepref{label-1.1} .~qed
end{proof}
step{label-2.1}{Text of substep 2}
end{proof}
step{label-2.2}{Text of step 2}
end{proof}
end{document}
so only text of step 1 and 2 are displayed after compiling, if I chose
pfhidelevel{2}, then also the next level will be shown etc.
Now to my enumitem solution
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
begin{document}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
Uwe Brauer
enumerate enumitem
I am currently getting acquainted with Leslie Lamports pf2.sty
(http://lamport.azurewebsites.net/latex/latex.html).
Which unfortunately is not on CTAN.
It intents to encourage a certain proof style, which Lamport calls
hierarchical proof.
A proof looks then a lot as nested enumerate environments
The pf2.sty package itself is not so comfortable and most of its
features can be achieved by using the enumitem package.
However there is one useful feature which I don't know how to implement
in vanilla latex, namely hide/show parts of the nested proofs.
Here is an example (presuming you have pf.sty
documentclass[12pt]{article}
usepackage{pf2}
begin{document}
pfhidelevel{1}
begin{proof}
step{item:test-lamport2:1b}{Text of step 1.}
begin{proof}
step{label-1.1}{Text of substep 1}
begin{proof}
pf Paragraph proof using results in stepref{label-1.1} .~qed
end{proof}
step{label-2.1}{Text of substep 2}
end{proof}
step{label-2.2}{Text of step 2}
end{proof}
end{document}
so only text of step 1 and 2 are displayed after compiling, if I chose
pfhidelevel{2}, then also the next level will be shown etc.
Now to my enumitem solution
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
begin{document}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
Uwe Brauer
enumerate enumitem
enumerate enumitem
edited Jul 26 at 20:39
asked Jul 26 at 16:18
Uwe Brauer
11
11
the implementation ofpfhidelevel
is pretty simple but it would be easier to answer if you provided a full document using pf2 so it can be tested and a second document with your proposedenumitem
markup (but without the hiding) so we just need to test adding the hide level feature.
– David Carlisle
Jul 26 at 20:18
I seem unable to add the required text. It will be malformed. any advice?
– Uwe Brauer
Jul 26 at 20:34
add a comment |
the implementation ofpfhidelevel
is pretty simple but it would be easier to answer if you provided a full document using pf2 so it can be tested and a second document with your proposedenumitem
markup (but without the hiding) so we just need to test adding the hide level feature.
– David Carlisle
Jul 26 at 20:18
I seem unable to add the required text. It will be malformed. any advice?
– Uwe Brauer
Jul 26 at 20:34
the implementation of
pfhidelevel
is pretty simple but it would be easier to answer if you provided a full document using pf2 so it can be tested and a second document with your proposed enumitem
markup (but without the hiding) so we just need to test adding the hide level feature.– David Carlisle
Jul 26 at 20:18
the implementation of
pfhidelevel
is pretty simple but it would be easier to answer if you provided a full document using pf2 so it can be tested and a second document with your proposed enumitem
markup (but without the hiding) so we just need to test adding the hide level feature.– David Carlisle
Jul 26 at 20:18
I seem unable to add the required text. It will be malformed. any advice?
– Uwe Brauer
Jul 26 at 20:34
I seem unable to add the required text. It will be malformed. any advice?
– Uwe Brauer
Jul 26 at 20:34
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Something like this
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
newcountpflevel
newcommandpfhidelevel[1]{pflevel=#1relax}
letzzenumerateenumerate
makeatletter
defenumerate{%
ifnumpflevel=@enumdepth
setbox0vboxbgroupbegingroupaftergroupegroupaftergroupendgroup
fi
zzenumerate}
begin{document}
00000
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
111111
pfhidelevel{1}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
2222222
pfhidelevel{2}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
great, thanks. the only thing: maybe it should be called showlevel, not hidehavel, because as higher the number is chosen as more is shown, but this is just nitpicking. thanks again.
– Uwe Brauer
Jul 26 at 21:29
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Something like this
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
newcountpflevel
newcommandpfhidelevel[1]{pflevel=#1relax}
letzzenumerateenumerate
makeatletter
defenumerate{%
ifnumpflevel=@enumdepth
setbox0vboxbgroupbegingroupaftergroupegroupaftergroupendgroup
fi
zzenumerate}
begin{document}
00000
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
111111
pfhidelevel{1}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
2222222
pfhidelevel{2}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
great, thanks. the only thing: maybe it should be called showlevel, not hidehavel, because as higher the number is chosen as more is shown, but this is just nitpicking. thanks again.
– Uwe Brauer
Jul 26 at 21:29
add a comment |
up vote
0
down vote
Something like this
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
newcountpflevel
newcommandpfhidelevel[1]{pflevel=#1relax}
letzzenumerateenumerate
makeatletter
defenumerate{%
ifnumpflevel=@enumdepth
setbox0vboxbgroupbegingroupaftergroupegroupaftergroupendgroup
fi
zzenumerate}
begin{document}
00000
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
111111
pfhidelevel{1}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
2222222
pfhidelevel{2}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
great, thanks. the only thing: maybe it should be called showlevel, not hidehavel, because as higher the number is chosen as more is shown, but this is just nitpicking. thanks again.
– Uwe Brauer
Jul 26 at 21:29
add a comment |
up vote
0
down vote
up vote
0
down vote
Something like this
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
newcountpflevel
newcommandpfhidelevel[1]{pflevel=#1relax}
letzzenumerateenumerate
makeatletter
defenumerate{%
ifnumpflevel=@enumdepth
setbox0vboxbgroupbegingroupaftergroupegroupaftergroupendgroup
fi
zzenumerate}
begin{document}
00000
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
111111
pfhidelevel{1}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
2222222
pfhidelevel{2}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
Something like this
documentclass[12pt]{article}
usepackage{amsmath,amssymb}
usepackage{enumitem}
setenumerate[1]{label=$langle$1$rangle$arabic*., ref=$langle$1$rangle$arabic*}
setenumerate[2]{label=$langle$2$rangle$arabic*., ref=$langle$1$rangle$ref=arabic*}
newcountpflevel
newcommandpfhidelevel[1]{pflevel=#1relax}
letzzenumerateenumerate
makeatletter
defenumerate{%
ifnumpflevel=@enumdepth
setbox0vboxbgroupbegingroupaftergroupegroupaftergroupendgroup
fi
zzenumerate}
begin{document}
00000
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
111111
pfhidelevel{1}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
2222222
pfhidelevel{2}
begin{enumerate}
item label{item:test-lamport2:1b}{Text of step 1.}
begin{enumerate}
item label{item:solution-enumitem:1} Text of substep 1
begin{enumerate}
item[textsc{PROOF}] Paragraph proof using results in
ref{item:solution-enumitem:1}. $blacksquare$
end{enumerate}
item label{label-2.1}{Text of substep 2}
end{enumerate}
item label{label-2.2}{Text of step 2}
end{enumerate}
end{document}
answered Jul 26 at 21:12
David Carlisle
478k3811091841
478k3811091841
great, thanks. the only thing: maybe it should be called showlevel, not hidehavel, because as higher the number is chosen as more is shown, but this is just nitpicking. thanks again.
– Uwe Brauer
Jul 26 at 21:29
add a comment |
great, thanks. the only thing: maybe it should be called showlevel, not hidehavel, because as higher the number is chosen as more is shown, but this is just nitpicking. thanks again.
– Uwe Brauer
Jul 26 at 21:29
great, thanks. the only thing: maybe it should be called showlevel, not hidehavel, because as higher the number is chosen as more is shown, but this is just nitpicking. thanks again.
– Uwe Brauer
Jul 26 at 21:29
great, thanks. the only thing: maybe it should be called showlevel, not hidehavel, because as higher the number is chosen as more is shown, but this is just nitpicking. thanks again.
– Uwe Brauer
Jul 26 at 21:29
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f443326%2flamport-pf2-sty-and-hide-show-parts-of-nested-enumerate-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
the implementation of
pfhidelevel
is pretty simple but it would be easier to answer if you provided a full document using pf2 so it can be tested and a second document with your proposedenumitem
markup (but without the hiding) so we just need to test adding the hide level feature.– David Carlisle
Jul 26 at 20:18
I seem unable to add the required text. It will be malformed. any advice?
– Uwe Brauer
Jul 26 at 20:34