Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数式モード内の \ref でエラー #55

Closed
aminophen opened this issue Oct 30, 2017 · 2 comments
Closed

数式モード内の \ref でエラー #55

aminophen opened this issue Oct 30, 2017 · 2 comments
Labels

Comments

@aminophen
Copy link
Member

#31 の「\ref とスペースファクター」の修正に伴い,forum:2294#p13462 の現象が発生しています。

You can't use `\spacefactor' in math mode.

\documentclass[uplatex,dvipdfmx]{jsarticle}
\begin{document}
\section{A}\label{A}

\section{B}
$\ref{A}$
\end{document}
@aminophen
Copy link
Member Author

一つの修正案としては,以下のようにすることでしょうか。

\@setref@ というマクロ名はテキトーです。目次で数式モードに入る場合も考慮すると,\protect しないといけないはずなので,こんな方法をとっています。

\def\@setref#1#2#3{%
  \ifx#1\relax
    \protect\G@refundefinedtrue
    \nfss@text{\reset@font\bfseries ??}%
    \@latex@warning{Reference `#3' on page \thepage \space
              undefined}%
  \else
    \expandafter#2#1\protect\@setref@{}% change \null to \protect\@setref@{}
  \fi}
\def\@setref@{\ifmmode\else\spacefactor\@m\fi}

@aminophen
Copy link
Member Author

2017-11-03 付けでリリースしました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant