
弦を変更できるようにしたいですvarioref
。特に、on the facing page
1 弦です。
問題はないはずです。ドキュメントには使用されているさまざまなマクロが明記されており、次の方法で変更できると思います。
\renewcommand\reftextfaceafter{on the following page}
\renewcommand\reftextafter {on the next page}
\renewcommand\reftextfacebefore{on the previous page}
\renewcommand\reftextbefore {on the previous page}
babel
と一緒に使用しない限り、これは正常に動作しますvarioref
。
MWE は次のとおりです:
\documentclass{book}
\usepackage[english]{babel} % works if this line is commented out
\usepackage{varioref}
\renewcommand\reftextfaceafter{on the following page}
\renewcommand\reftextafter {on the next page}
\renewcommand\reftextfacebefore{on the previous page}
\renewcommand\reftextbefore {on the previous page}
\begin{document}
empty page
\clearpage
\begin{figure}
\centering
\rule{5cm}{3cm}
\caption{Caption}
\label{fig}
\end{figure}
\clearpage
Figure \vref{fig}
\end{document}
答え1
\renewcommand
の後に sを置くと\begin{document}
、正常に動作します。プリアンブルに置くと、プリアンブルの最後またはドキュメントの先頭で設定が行われたときに上書きされます。
\begin{document}
しかし、私はそれらを後に置くことが正しい解決策ではないと思います。ヴァリオレフ、文書の修正された指示が見つかりますバベルこれらは次のコードを提案します:
\documentclass[english]{book}
\usepackage{babel} % works if this line is commented out
\usepackage{varioref}
\addto\extrasenglish{% page 5 of varioref's manual
\renewcommand\reftextfaceafter{on the following page}%
\renewcommand\reftextafter {on the next page}%
\renewcommand\reftextfacebefore{on the previous page}%
\renewcommand\reftextbefore {on the previous page}%
}
\begin{document}
empty page
\clearpage
\begin{figure}
\centering
\rule{5cm}{3cm}
\caption{Caption}
\label{fig}
\end{figure}
\clearpage
Figure \vref{fig}
\end{document}
english
直接 に渡すのではなく、ドキュメント クラスに渡すことでbabel
、言語を認識する他のパッケージが設定を取得できるようになることに注意してください。
答え2
babel
は でいくつかの再定義を行う\AtBeginDocument
ため、マクロ\renewcommand
の を\ref....
後からでもフックする必要があります。つまり、\AtBeginDocument{...}
の周囲でを使用する\renewcommand
と、変更が有効になります。これは、この新しい\AtBeginDocument
コンテンツの追加が以前の追加よりも後に実行されるためです。(それ以外の場合は、cfr のソリューションで提案されている - アプローチを使用します\addto
。これはパッケージのマニュアルにvarioref
も記載されています)
\documentclass{book}
\usepackage[english]{babel} % works if this line is commented out
\usepackage{varioref}
\AtBeginDocument{%
\renewcommand\reftextfaceafter{on the following page}
\renewcommand\reftextafter{on the next page}
\renewcommand\reftextfacebefore{on the previous page}
\renewcommand\reftextbefore{on the previous page}
}
\begin{document}
empty page
\clearpage
\begin{figure}
\centering
\rule{5cm}{3cm}
\caption{Caption}
\label{fig}
\end{figure}
\clearpage
Figure \vref{fig}
\end{document}