
Eu gostaria de poder mudar as varioref
cordas. Em particular, on the facing page
aquele.
Não deveria ser um problema. A documentação indica claramente várias macros usadas, e eu acho que seria capaz de alterá-las usando:
\renewcommand\reftextfaceafter{on the following page}
\renewcommand\reftextafter {on the next page}
\renewcommand\reftextfacebefore{on the previous page}
\renewcommand\reftextbefore {on the previous page}
Isso funciona bem, a menos que eu use babel
junto com varioref
.
MWE segue:
\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}
Responder1
Se você colocar o \renewcommand
s depois \begin{document}
, funciona bem. Se você colocá-los no preâmbulo, eles serão substituídos quando as coisas forem configuradas no final do preâmbulo/início do documento.
No entanto, não acho que colocá-los depois \begin{document}
seja a solução correta. Olhando o manual paravariref, encontramos instruções modificadas para documentos que usambabel. Eles sugerem o seguinte código:
\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}
Observe que, ao passar english
para a classe document, em vez de diretamente para babel
, outros pacotes que reconhecem o idioma poderão escolher a configuração.
Responder2
babel
faz algumas redefinições logo no \AtBeginDocument
, então o \renewcommand
das \ref....
macros deve ser enganchado ainda mais tarde, ou seja, use \AtBeginDocument{...}
em torno do \renewcommand
e as alterações entram em ação, já que essa nova \AtBeginDocument
adição de conteúdo é executada após as anteriores. (Caso contrário, use a abordagem - conforme sugerido pela solução do cfr - isso também \addto
é mencionado no manual do pacote)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}