xsim 反向同步问题

xsim 反向同步问题

xsim我在使用反向同步(从文档到源)时可能遇到了包的奇怪行为。

预期行为

我在我的 IDE 中激活了反向同步,然后在单击文档内部时我就会指向相应源代码中的相关行。

观察到的行为

对于使用 定义的环境xsim,反向 synctex 仅指向环境的结尾。xsim无论我自己定义它们还是使用提供的 ,这种行为都会发生在所有环境中exercise-template = default

平均能量损失

请参阅以下 MWE 来自己评估行为:

\documentclass{scrbook}

% option blank does not use any pre-defined xsim environments
\usepackage[no-files, blank]{xsim}
\usepackage{amsthm}

%  create my own exercise environment
\DeclareExerciseType{exercise}{
    exercise-env = exercise,
    solution-env = solution,
    exercise-name = \XSIMtranslate{exercise},
    exercises-name = \XSIMtranslate{exercises},
    solution-name = \XSIMtranslate{solution},
    solutions-name = \XSIMtranslate{solutions},
    exercise-template = xsimTemplateMWE,
    solution-template = xsimTemplateMWE,
}

% declare an xsim template
\DeclareExerciseEnvironmentTemplate{xsimTemplateMWE}{
    \vspace{\abovedisplayskip}\noindent\ignorespaces
    Exercise:
}{%
    \par%
    \ignorespacesafterend%
    \vspace{\belowdisplayskip}%
}

% declare custom environment for comparison
\NewDocumentEnvironment{test}{ O{} }{%
    \vspace{\abovedisplayskip}%
    \noindent\ignorespaces%
    Test:
    }{
    \par%
    \ignorespacesafterend%
    \vspace{\belowdisplayskip}%
}

%  declare a amsthm environment based on trivlist for comparison
\newtheorem{testthm}{Testtheorem}


\begin{document}
\begin{exercise}
    This is Exercise~1.

    Notice, that if you reverse synctex (from document to source), your cursor will be at the end of the exercise environement, regardless where you clicked at.

    You can also verify with this paragraph.

\end{exercise}

\begin{solution}
    This is solution~1.
\end{solution}


\begin{test}
    This is a test environment.

    Notice, that you jump to the right paragrpah using reverse synctex (from document to source).

    You can also verify with this paragraph.


\end{test}

\begin{testthm}
    This is a testthm environment.

    Notice that reverse synctex (from document to source) works, despite this environment being based on trivlist.

    You can also verify with this paragraph.
\end{testthm}
\end{document}

我想找到一种解决方法或修复方法来实现预期的行为。

行为示范

相关内容