Open czhang03 opened 2 years ago
I think the more reasonable behavior is that when debug
is enabled, proofEnd
environment simply become an alias for proof
environment.
It seems like debug
exactly make the proofEnd
env to proof
env, then maybe is just a problem with synctex doesn't mix with compiler flag?
Hum, seems like you are right… Not sure why I never spotted it before, I was more or less sure that before it was working fine… but maybe not. I'll try to see if it's not a regression, and investigate (synctex is not really flexible ^^). Thanks!
Ok, so I tried with an older version and the issue was already present (maybe it was just a dream that this worked in older versions). So in fact, it seems that as soon one needs to capture the content of the environment, we lose the synctex behavior. This is visible on creating a really small example using either xparse
and the +b
environment option, or environ
.
I'm not sure if this is fundamental or not, so I tried to ask a question here. If I can't find any solution, I will surely define a way to locally redefine the theoremEnd
environment. For now, as a workaround, you can put:
\RenewDocumentEnvironment{theoremEnd}{O{}mO{}}{\begin{#2}}{\end{#2}}
\RenewDocumentEnvironment{proofEnd}{O{}}{\begin{proof}}{\end{proof}}
before the theorem that should be debugged (or at the beginning of the file if you want to debug everything). If you want to debug a single theorem, you can put these definitions and the theorem in a group (i.e. embraced by brackets {...}
).
Due to the way LaTeX works, there is no nice way to add arguments like debug
since the whole macro definition must be redefined. So I defined some shortcuts, like \begin{theoremEndDebug}
and \begin{proofEndDebug}
enables the debug version for theorems and proofs (do not forgot to set the proof if you set the theorem), same for thmE
that becomes thmED
… and you can also use \proofEnableDebugSynctex{}
to enable globally the debug mode (warning: it won't work with restate).
Your example now becomes:
\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage[conf={}]{proof-at-the-end}
\newtheorem{lemma}{Lemma}
\begin{document}
%% Or use
%% \proofEnableDebugSynctex{}
\begin{theoremEndDebug}{lemma}
This
is
a
very
long
lemma
\end{theoremEndDebug}
\begin{proofEndDebug}
This
is
a
very
long
proof
\end{proofEndDebug}
\begin{lemma}
This
is
a
very
long
lemma
\end{lemma}
\begin{proof}
This
is
a
very
long
proof
\end{proof}
\newpage
\section{Blabla}
\printProofs
\end{document}
I keep this issue open until I document this properly.
Yeah, but changing all to ProofEndDebug
will just be like proof
>
Kind of, except in rare cases when people provide arguments to the proofEnd
, the proofEndDebug
will ignore these arguments. Note that if you want to change multiples environments at once, you can use instead \proofEnableDebugSynctex{}
(that internally redefines proofEnd
and theoremEnd
), it will enable debug mode for all subsequent theorems. I don't really see any other way due to how LaTeX works; as there is no way to both capture the content of an environment (option +b
) and keep synctex working. For instance, check the restatable
package, it has the same issue.
But I'm not sure to see what is your expectation. What other interface would you prefer to have?
I may found a solution to provide a simpler interface for this, keeping the old debug
flag, thanks to this answer https://tex.stackexchange.com/a/646087/116348
Describe the bug synctex will navigate to the end of the proof/theorem, instead of the exact line, even when
debug
mode is enabled.To Reproduce: Minimal Working Example
Version
Version of
proof-at-the-end
:Packaged on Tue Feb 8 16:11:27 2022
or the GitHub version works the same.Additional context I am using vscode with LaTeX workshop, and synctex version 1.5.
When I synctex on a line in a
theroemEnd
orproofEnd
, I get navigated to the line\end{theroemEnd}
or\end{proofEnd}
, even withdebug
enabled. Whereas in the normallemma
andproof
environment, I get navigated to the exact line corresponding to the place I clicked.