![使 $\C$ 更容易用於複數:與 T2A、mismath 和 babel 衝突](https://rvso.com/image/399813/%E4%BD%BF%20%24%5CC%24%20%E6%9B%B4%E5%AE%B9%E6%98%93%E7%94%A8%E6%96%BC%E8%A4%87%E6%95%B8%EF%BC%9A%E8%88%87%20T2A%E3%80%81mismath%20%E5%92%8C%20babel%20%E8%A1%9D%E7%AA%81.png)
我強烈傾向於使用 來$\C$
表示複數集合,就像我用來$\R$
表示實數一樣 - 無論是使用\mathbb
還是\mathbf
。
其他幾個套件使用它們自己的\C
: t2aenc.def
(調用自\usepackage[T2A,T1]{fontenc}
);的定義。 mismath.sty
;以及hyperref.sty
它所呼叫的任一或某個包。
我的解決方法如下面的 MWE 所示。
問題:有沒有更簡單的方法來實現這一點——無需反覆重新定義\C
?
筆記:
- 我不太可能需要
\C
frombabel
使用 T2A。我不確定如何hyperref
使用\C
. (用於塞爾維亞-克羅埃西亞語和斯洛維尼亞語中的雙音。) - 我正在使用 pdflatex 和不是xelatex 或 lualatex!
來源 MWE:
\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[russian,french,german,polish,main=english]{babel}
% Avoid \lll clash with def in amssymb.sty:
\makeatletter
\let\polish@l=\ll
\let\polish@L=\LLL
\let\lll\relax \let\LLL\relax % undefine them
\def\plll{\polish@l}
\def\pLLL{\polish@L}
\makeatother
\usepackage{amsmath,amssymb}
% Choose ONE of the following two defs:
%\newcommand{\numsys}[1]{\mathbb{#1}}
\newcommand{\numsys}[1]{\mathbf{#1}}
% First
\makeatletter
\def\my@textormath{%
\ifmmode
\expandafter\@secondoftwo
\else
\expandafter\@firstoftwo
\fi}
\ifcsname C\endcsname
\let\oldC\C
\def\C{\my@textormath{\oldC}{\numsys{C}}}
\fi
\makeatother
\usepackage{mismath} % defines \Z, \Z, \Q, \R, \C with mathbf
\usepackage[pdftex]{hyperref}
\makeatletter
\def\my@textormath{%
\ifmmode
\expandafter\@secondoftwo
\else
\expandafter\@firstoftwo
\fi}
\@ifpackageloaded{hyperref}{% then
\let\newerC\C
\def\C{\my@textormath{\newerC}{\numsys{C}}}}%
{}
\makeatother
\renewcommand{\N}{\numsys{N}}
\renewcommand{\Z}{\numsys{Z}}
\renewcommand{\Q}{\numsys{Q}}
\renewcommand{\R}{\numsys{R}}
\begin{document}
$\N \subset \Z \subset \Q \subset \R \subset \C$
\end{document}
答案1
如果您希望您的定義獲勝,請盡可能晚地添加
\AtBeginDocument{\def\C{\numsys{C}}}