
텍스트 모드에서 "oldstyle" 옵션을 사용하고 수학 모드에서 Charter 문자(숫자 포함)를 사용하는 Charter를 어떻게 얻을 수 있나요?
제안된 솔루션은 LuaLaTeX와 함께 작동해야 합니다(일부 텍스트 문자는 ASCII가 아니며 저는 이러한 비ASCII 문자를 소스 파일에 붙여넣고 소스를 UTF-8로 저장하는 것을 선호하기 때문입니다).
편집하다:관련이 있는 경우를 대비하여 MiKTeX v.2.9를 사용합니다. 이 문제를 해결하려면 업그레이드해야 합니까?
감질나게 가까이 다가갈 수는 있지만 모든 것을 동시에 작동시킬 수는 없습니다.
MWE 1:
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{fontspec}
\setmainfont{XCharter} % see https://tex.stackexchange.com/a/205558
\usepackage[oldstyle]{xcharter}
% See https://tex.stackexchange.com/a/347574 for why this is needed.
\AtBeginDocument{%
\Umathcode`0="7 "0 `0
\Umathcode`1="7 "0 `1
\Umathcode`2="7 "0 `2
\Umathcode`3="7 "0 `3
\Umathcode`4="7 "0 `4
\Umathcode`5="7 "0 `5
\Umathcode`6="7 "0 `6
\Umathcode`7="7 "0 `7
\Umathcode`8="7 "0 `8
\Umathcode`9="7 "0 `9
}
\usepackage[charter]{newtxmath}
\begin{document}
Digits in plain text: 48/96=135/270.
$a=48, b=96, c=135, d=270\implies a/b=c/d.$ $8=5+3=9-1=2\times4=2^3.$
\end{document}
텍스트 모드의 숫자는 내가 원하는 방식입니다. 게다가 수학 모드의 글자는 제가 원하는 Charter 이탤릭체입니다. 그러나 수학 모드의 숫자는 Computer Modern입니다.이 답변, Libertine과 관련된 비슷한 질문에 답변했습니다.
MWE 2
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{fontspec}
\setmainfont{XCharter}[Numbers={OldStyle}] % see https://tex.stackexchange.com/a/205558
\usepackage[charter]{newtxmath}
% See https://tex.stackexchange.com/a/347574 for why this is needed.
\AtBeginDocument{%
\Umathcode`0="7 "0 `0
\Umathcode`1="7 "0 `1
\Umathcode`2="7 "0 `2
\Umathcode`3="7 "0 `3
\Umathcode`4="7 "0 `4
\Umathcode`5="7 "0 `5
\Umathcode`6="7 "0 `6
\Umathcode`7="7 "0 `7
\Umathcode`8="7 "0 `8
\Umathcode`9="7 "0 `9
}
\begin{document}
Digits in plain text: 48/96=135/270.
$a=48, b=96, c=135, d=270\implies ab=cd.$ $8=5+3=9-1=2\times4=2^3.$
\end{document}
이제 \usepackage{xcharter} 대신 \setmainfont를 해킹하여 텍스트 모드에서 이전 스타일의 숫자를 얻으려고 합니다. 그러나 이것은 (oldstyle이 아닌) oldstyleI 매개변수를 \usepackage{xcharter}에 전달하는 것으로 보입니다. 어쨌든 결과는 텍스트 모드에 구식 숫자가 있지만 1에 작은 대문자 I가 있다는 것입니다. 좋은 소식은 수학 모드의 숫자가 제가 원하는 Charter라는 것입니다.
텍스트 모드와 수학 모드 모두에서 구식 헌장 숫자를 사용할 수 있다면 더욱 좋을 것입니다. 그렇게 하면 수학 모드에서 테이블을 배열 환경으로 유지할 수 있습니다. 표의 숫자를 텍스트 모드로 전환하려면 를 $\begin{array}{r} n \\ 1 \end{array}$
로 바꿔야 합니다 \begin{tabular}{r} $n$ \\ 1 \end{tabular}
.
답변1
LuaLaTeX를 사용하고 있기 때문에 호환성 문제가 있는 를 unicode-math
대신 로드할 수 있습니다. newtxmath
수학에는 XCharter-Math 글꼴을 사용하세요.
편집하다:의견에서 귀하는 [oldstyleI]
XCharter의 OpenType 버전에서 문자 변형 01인 숫자 1을 에서 요청했습니다. 수정된 버전은 아래와 같습니다.
\documentclass[12pt,a4paper]{article}
\usepackage{unicode-math}
\defaultfontfeatures[XCharter]{ Numbers=OldStyle,
CharacterVariant=1, % Change the shape of 1 in text mode
UprightFont=*-Roman,
BoldFont=*-Bold,
ItalicFont=*-Italic,
SlantedFont=*-Slanted,
BoldItalicFont=*-BoldItalic,
BoldSlantedFont=*-BoldSlanted,
Extension=.otf }
\setmainfont{XCharter}
\setmathfont{XCharter-Math}
\begin{document}
Digits in plain text: 48/96=135/270.
$a=48, b=96, c=135, d=270\implies ab=cd.$ $8=5+3=9-1=2\times4=2^3.$
\end{document}
수학 모드에서도 이전 스타일의 숫자를 원할 경우 다음 명령을 추가할 수 있습니다.
\setmathfont{XCharter-Roman.otf}[range={up/num},
Numbers=OldStyle,
CharacterVariant=01] % Change the shape of 1 in math mode
PDFLaTeX에서 작동하는 버전은 다음과 같습니다.
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage[charter]{mathdesign}
\usepackage[oldstyle]{xcharter}
\begin{document}
Digits in plain text: 48/96=135/270.
$a=48, b=96, c=135, d=270\implies ab=cd.$ $8=5+3=9-1=2\times4=2^3.$
\end{document}
unicode-math
가능하면 LuaLaTeX를 사용하고, 필요한 경우 레거시 8비트 글꼴이 포함된 PDFLaTeX를 사용하는 것이 좋습니다 . 그러나 여기서 문제는 유니코드를 읽을 수 없다는 점에서 문서를 NFC(정규화된 사전 구성) UTF-8 인코딩으로 저장하면 문서가 작동할 가능성이 높습니다. PDFLaTeX는 유니코드 결합 문자를 이해할 수 없지만 8비트 입력 인코딩에 직접 매핑되는 모든 유니코드 문자를 처리할 수 있습니다.
편집하다:
기존 Type 1 수학 글꼴과 함께 OpenType 텍스트 글꼴을 사용하려는 경우 다음이 작동합니다.
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage[charter]{mathdesign}
\usepackage{fontspec}
\setmainfont{XCharter}[NFSSFamily=mdbch, Numbers=OldStyle]
\begin{document}
Digits in plain text: 48/96=135/270.
$a=48, b=96, c=135, d=270\implies ab=cd.$ $8=5+3=9-1=2\times4=2^3.$
\end{document}
답변2
를 사용하지 않으려면 XCharter를 안감 그림과 함께 사용하도록 글꼴을 unicode-math
다시 정의해야 합니다 .operators
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage[charter]{newtxmath}
\setmainfont{XCharter}[Numbers={OldStyle}] % see https://tex.stackexchange.com/a/205558
\newfontfamily{\XCharterLF}{XCharter}[NFSSFamily=xcharterlf]
\DeclareSymbolFont{operators}{TU}{xcharterlf}{m}{n}
\begin{document}
Digits in plain text: 48/96=135/270.
$a=48, b=96, c=135, d=270\implies ab=cd$.
$8=5+3=9-1=2\times4=2^3$.
$\sin x$
\end{document}