amscd와 unicode-math 간의 충돌
Oct 12 2020
unicode-math 패키지로 전환 한 후 교환 다이어그램 용 amscd 패키지가 더 이상 작동하지 않습니다. 오류 메시지는 나타나지 않지만 @ 및 <와 같은 기호가 출력에 표시됩니다.
이전에 작동했던 거의 최소한의 예를 첨부합니다.
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{amscd}
\newcommand\xbf[1]{#1}
\newcommand\fg[1]{#1}
\newcommand\obf[1]{#1}
\newcommand\R{{R}}
\begin{document}
Diagram:
\begin{equation*}
\begin{CD}
\obf{\omega} \in \R^{3\times 3} @<\xbf{Ad}_{\xbf{B}}<< \obf{\Omega} \in \R^{3\times 3} \\
@A\hat{\ }AA @AA\hat{\ }A\\
\fg{\omega}=\xbf{B}\fg{\Omega} \in\R^3 @<\xbf{B}<< \fg{\Omega}\in \R^3
\end{CD}
\end{equation*}
\end{document}
답변
4 egreg Oct 12 2020 at 22:14
amscd패키지 수행
\mathcode`@="8000
@수학을 활성화 하기 위해 . 또한 실행 \CDat시작시 CD환경 \CDat에 의해 정의된다
\gdef\CDat{\let @=\Iat}
@이 활성화 된 컨텍스트에서 . 그것이 무엇인지 아는 것은 중요하지 않습니다 \Iat. 단지 @수학적으로 활발하고 환경을 \Iat처리 하는 동안 의미를 갖는 것이 필수적이라는 CD것입니다.
불행히도는에서 unicode-math수학 코드를 정규화 \begin{document}하므로의 수학 코드 설정을 @잊었습니다.
실제로 CD환경 의 정의를 개선하여 주변 조건과 독립적으로 만들 수 있습니다 ( amscd패키지 에서도 수행해야 했지만 그렇지 않은 역사적 이유가 있습니다).
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amscd}
\usepackage{unicode-math}
\begingroup\lccode`~=`@ \lowercase{\endgroup
\def\CDat{\let~\Iat\mathcode`@="8000\relax}%
}
\newcommand\xbf[1]{#1}
\newcommand\fg[1]{#1}
\newcommand\obf[1]{#1}
\newcommand\R{{R}}
\begin{document}
Diagram:
\begin{equation*}
\begin{CD}
\obf{\omega} \in \R^{3\times 3} @<\xbf{Ad}_{\xbf{B}}<< \obf{\Omega} \in \R^{3\times 3} \\
@A\hat{\ }AA @AA\hat{\ }A\\
\fg{\omega}=\xbf{B}\fg{\Omega} \in\R^3 @<\xbf{B}<< \fg{\Omega}\in \R^3
\end{CD}
\end{equation*}
\end{document}
또한 라텍스의 마지막 릴리스 (2020년 10월 1일), 당신은에서 코드의 세 줄을 교체 할 수 있습니다 \begingroup에 }와
\AtBeginEnvironment{CD}{\mathcode`@="8000\relax}
이것은 나에게 덜 매력적이지만.
와 함께 tikz-cd:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{tikz-cd}
\newcommand\xbf[1]{#1}
\newcommand\fg[1]{#1}
\newcommand\obf[1]{#1}
\newcommand\R{{R}}
\begin{document}
Diagram:
\begin{equation*}
\begin{tikzcd}
\obf{\omega} \in \R^{3\times 3} &
\obf{\Omega} \in \R^{3\times 3} \arrow[l,"\xbf{Ad}_{\xbf{B}}"']
\\
\fg{\omega}=\xbf{B}\fg{\Omega} \in\R^3 \arrow[u,"\hat{\ }"] &
\fg{\Omega}\in \R^3 \arrow[l,"\xbf{B}"'] \arrow[u,"\hat{\ }"]
\end{tikzcd}
\end{equation*}
\end{document}
3 UlrikeFischer Oct 12 2020 at 20:44
@의 수학 코드를 재설정하면 다시 작동하는 것 같습니다.
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amscd}
\usepackage{unicode-math}
\newcommand\xbf[1]{#1}
\newcommand\fg[1]{#1}
\newcommand\obf[1]{#1}
\newcommand\R{{R}}
\begin{document}
Diagram:
\begin{equation*}\mathcode`\@="8000
\begin{CD}
\obf{\omega} \in \R^{3\times 3} @<\xbf{Ad}_{\xbf{B}}<< \obf{\Omega} \in \R^{3\times 3} \\
@A\hat{\ }AA @AA\hat{\ }A\\
\fg{\omega}=\xbf{B}\fg{\Omega} \in\R^3 @<\xbf{B}<< \fg{\Omega}\in \R^3
\end{CD}
\end{equation*}
\end{document}