如何修复不同字体之间的大小

如何修复不同字体之间的大小

实际问题:

如何使第二种字体具有与第一种字体相同的“实际”大小。

\documentclass[a4paper, 12pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{amsmath}

\newcommand*{\afont}{\fontsize{14}{48}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\texta}{\afont}
\newcommand*{\bfont}{\fontsize{21}{48}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textb}{\bfont}
\newcommand*{\cfont}{\fontsize{30}{48}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textc}{\cfont}

\newcommand{\printa}[1]{\texta{#1}}
\newcommand{\printb}[1]{\textb{#1}}
\newcommand{\printc}[1]{\textc{#1}}

\DeclareMathOperator{\matha}{\printa{SPEZIAL}}
\DeclareMathOperator{\mathb}{\printb{SPEZIAL}}
\DeclareMathOperator{\mathc}{\printc{SPEZIAL}}
\DeclareMathOperator{\mathd}{\printd{SPEZIAL}}

\begin{document}
\chapter{Test}
This Is A Great Sentence With A $\matha$ Word.\\
{\Large This Is A Great Sentence With A $\mathb$ Word.}\\
{\Huge This Is A Great Sentence With A $\mathc$ Word.}\\
\\
SPEZIAL=14 rest=12 difference=2\\
SPEZIAL=21 rest=17 difference=4\\
SPEZIAL=30 rest=25 difference=5
\end{document}

有没有办法定义第二种字体的 normalsize、large、Large 等以适合文本的其余部分?


我在一个文档中使用两种不同的字体。

简写:

\documentclass[a4paper, 12pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{amsmath}

\newcommand*{\myfont}{\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textmy}{\myfont}

\newcommand{\printmy}[1]{\textmy{#1}}

\DeclareMathOperator{\mathmy}{\printmy{SPEZIAL}}

\begin{document}
\chapter{Test}
This Is A Great Sentence With A $\mathmy$ Word.\\
This Is A Great Sentence With A {\large $\mathmy$} Word.\\ %bad fix
{\large This Is A Great Sentence With A $\mathmy$ Word.}
\end{document}

SPEZIAL 单词使用的大小不正确。


长表:

这里是一个(不是真正的) MWE,而是一个具有不同大小的测试文档。

\documentclass[a4paper, 12pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{amsmath}

\newcommand*{\nofont}{\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textno}{\nofont}
\newcommand*{\largefont}{\large\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textlarge}{\largefont}
\newcommand*{\afont}{\fontsize{12}{90}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\texta}{\afont}
\newcommand*{\bfont}{\fontsize{12}{1}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textb}{\bfont}
\newcommand*{\cfont}{\fontsize{12}{200}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textc}{\cfont}
\newcommand*{\dfont}{\fontsize{12}{48}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textd}{\dfont}
\newcommand*{\efont}{\fontsize{13}{48}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\texte}{\efont}
\newcommand*{\ffont}{\fontsize{14}{48}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textf}{\ffont}
\newcommand*{\gfont}{\fontsize{15}{48}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\textg}{\gfont}
\newcommand*{\hfont}{\fontsize{16}{48}\itshape\fontfamily{qzc}\selectfont}
\DeclareTextFontCommand{\texth}{\hfont}

\newcommand{\printno}[1]{\textno{#1}}
\newcommand{\printlarge}[1]{\textlarge{#1}}
\newcommand{\printa}[1]{\texta{#1}}
\newcommand{\printb}[1]{\textb{#1}}
\newcommand{\printc}[1]{\textc{#1}}
\newcommand{\printd}[1]{\textd{#1}}
\newcommand{\printe}[1]{\texte{#1}}
\newcommand{\printf}[1]{\textf{#1}}
\newcommand{\printg}[1]{\textg{#1}}
\newcommand{\printh}[1]{\texth{#1}}

\DeclareMathOperator{\mathno}{\printno{SPEZIAL}}
\DeclareMathOperator{\mathlarge}{\printlarge{SPEZIAL}}
\DeclareMathOperator{\matha}{\printa{SPEZIAL}}
\DeclareMathOperator{\mathb}{\printb{SPEZIAL}}
\DeclareMathOperator{\mathc}{\printc{SPEZIAL}}
\DeclareMathOperator{\mathd}{\printd{SPEZIAL}}
\DeclareMathOperator{\mathe}{\printe{SPEZIAL}}
\DeclareMathOperator{\mathf}{\printf{SPEZIAL}}
\DeclareMathOperator{\mathg}{\printg{SPEZIAL}}
\DeclareMathOperator{\mathh}{\printh{SPEZIAL}}

\begin{document}
\chapter{Test}
This Is A Great Sentence With A $\mathno$ Word.

This Is A Great Sentence With A $\mathlarge$ Word. I guess this is the right size.

{\large This Is A Great Sentence With A $\mathlarge$ Word. Doesn't grow.}

This Is A Great Sentence With A $\matha$ Word.

This Is A Great Sentence With A $\mathb$ Word.

This Is A Great Sentence With A $\mathc$ Word.

This Is A Great Sentence With A $\mathd$ Word.

This Is A Great Sentence With A $\mathe$ Word.

This Is A Great Sentence With A $\mathf$ Word. I guess this is the right size, too.

{\large This Is A Great Sentence With A $\mathf$ Word. Doesn't grow.}

This Is A Great Sentence With A $\mathg$ Word.

This Is A Great Sentence With A $\mathh$ Word.
\end{document}

我觉得第一个变体太小了。所以我尝试将其放大(以正确的方式)。


到目前为止,我的结果是找到了两个解决方案,但它们并没有随着文本的其余部分而增长。

未解决的问题:

  1. 第二个解决方案比第一个解决方案“更正确”吗?相等吗?第一个更好吗?
  2. 如何让两种字体同时增大
  3. fontsize 的第二个参数无效。(我猜这可能只存在于我的例子中)“默认”值是什么?/我应该使用哪个值(即使它无关紧要)

注释:\itshape仅用于qzcupshape 中不可用

答案1

字体大小在相关意义上并未标准化。在这种情况下,如果您要求它跳过右边的 a 或绘制许多s 厚的规则或其他什么的, TeXpt不会给您标准。ptptpt

考虑字体大小时,a 的大小pt取决于字体。因此,12pt是相对于字体的大小。对于您示例中的每种字体\normalsize都是如此,但并不相同。12pt12pt

要查看此内容,请尝试

\documentclass[border=0pt,multi,tikz]{standalone}
% \usepackage{lmodern}% 3mm x 3mm
% \usepackage{venturis}% 2mm x 2mm
\usepackage[scale=1]{tgchorus}% 2mm x 2mm
\begin{document}
\begin{tikzpicture}[inner sep=0pt]
  \node [draw] {X};
\end{tikzpicture}
\end{document}

取消注释不同的软件包会导致 PDF 大小不同。有些软件包高 2 毫米,有些高 3 毫米。

这就是为什么原本设计为不兼容的字体通常需要缩放才能产生良好效果的原因。某些字体(包括 Chorus)在安装时会考虑缩放。在这些情况下,可以轻松缩放字体以匹配文档中的其他字体。

我猜你想要这样的东西:

{\tiny This Is A Great Sentence With A $\spezial$ Word.\par}

{\scriptsize This Is A Great Sentence With A $\spezial$ Word. I guess this is the right size.\par}

{\footnotesize This Is A Great Sentence With A $\spezial$ Word.\par}

{\small This Is A Great Sentence With A $\spezial$ Word.\par}

{\normalsize This Is A Great Sentence With A $\spezial$ Word.\par}

{\large This Is A Great Sentence With A $\spezial$ Word.\par}

{\Large This Is A Great Sentence With A $\spezial$ Word.\par}

{\LARGE This Is A Great Sentence With A $\spezial$ Word. I guess this is the right size, too.\par}

{\Huge This Is A Great Sentence With A $\spezial$ Word. Doesn't grow.\par}

This Is A Great Sentence With A $\spezial$ Word.

生成如下内容:

缩放合唱以匹配拉丁现代

或这个:

{\tiny This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\scriptsize This Is A \qzctext{Great} Sentence With A $\spezial$ Word. I guess this is the right size.\par}

{\footnotesize This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\small This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\normalsize This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\large This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\Large This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\LARGE This Is A \qzctext{Great} Sentence With A $\spezial$ Word. I guess this is the right size, too.\par}

{\Huge This Is A \qzctext{Great} Sentence With A $\spezial$ Word. Doesn't grow.\par}

This Is A \qzctext{Great} Sentence With A $\spezial$ Word.

生成如下内容:

在文本和数学模式下缩放合唱

我通过使用缩放 Chorus 来实现这一点

\newcommand*\qzc@scale{1.2}

我的 Chorus 字体配置如下

\DeclareRobustCommand\qzcstyle{%
  \fontencoding{T1}%
  \fontseries{m}%
  \fontshape{it}%
  \fontfamily{qzc}%
  \selectfont
}

对于基本命令和

\DeclareTextFontCommand\qzctext{%
  \qzcstyle
}

用于文本命令。

为了方便起见,我定义

\newcommand*\textqzc[1]{\text{\qzctext{#1}}}

用于数学模式和

\newcommand*\spezial{\textqzc{SPEZIAL}}

供测试用。

请注意,这\text{}在数学模式下很重要,因为它\mathchoice可以控制数学原子相对于其他原子的大小和间距。

比较两个版本。第一个版本使用 排版\textqzc,使用\text{\qzctext{}}

\[
  \sum_{\textqzc{i}=1}^n \frac{\textqzc{a}^2 + 3^{\textqzc{b}}}{\textqzc{ab}^2 + n^{\textqzc{a}}}
\]

第二个直接使用\qzctext{}

\[
  \sum_{\qzctext{i}=1}^n \frac{\qzctext{a}^2 + 3^{\qzctext{b}}}{\qzctext{ab}^2 + n^{\qzctext{a}}}
\]

结果如下:

比较:有和没有 \text

可以看出,第二个版本中的间距不正确,因为它\qzctext{}是文本字体命令,并且没有在数学模式下为间距留出适当的余地。第一个版本使用\text{}调用\mathchoice进行必要的调整,间距是正确的。

完整代码:

\documentclass[a4paper, 12pt]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}
\makeatletter
\newcommand*\qzc@scale{1.2}
\DeclareRobustCommand\qzcstyle{%
  \fontencoding{T1}%
  \fontseries{m}%
  \fontshape{it}%
  \fontfamily{qzc}%
  \selectfont
}
\makeatother
\DeclareTextFontCommand\qzctext{%
  \qzcstyle
}
\newcommand*\textqzc[1]{\text{\qzctext{#1}}}
\newcommand*\spezial{\textqzc{SPEZIAL}}

\begin{document}

% scaled Chorus in maths mode using \text{}

{\tiny This Is A Great Sentence With A $\spezial$ Word.\par}

{\scriptsize This Is A Great Sentence With A $\spezial$ Word. I guess this is the right size.\par}

{\footnotesize This Is A Great Sentence With A $\spezial$ Word.\par}

{\small This Is A Great Sentence With A $\spezial$ Word.\par}

{\normalsize This Is A Great Sentence With A $\spezial$ Word.\par}

{\large This Is A Great Sentence With A $\spezial$ Word.\par}

{\Large This Is A Great Sentence With A $\spezial$ Word.\par}

{\LARGE This Is A Great Sentence With A $\spezial$ Word. I guess this is the right size, too.\par}

{\Huge This Is A Great Sentence With A $\spezial$ Word. Doesn't grow.\par}

This Is A Great Sentence With A $\spezial$ Word.

% scaled Chorus in text and maths modes

{\tiny This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\scriptsize This Is A \qzctext{Great} Sentence With A $\spezial$ Word. I guess this is the right size.\par}

{\footnotesize This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\small This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\normalsize This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\large This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\Large This Is A \qzctext{Great} Sentence With A $\spezial$ Word.\par}

{\LARGE This Is A \qzctext{Great} Sentence With A $\spezial$ Word. I guess this is the right size, too.\par}

{\Huge This Is A \qzctext{Great} Sentence With A $\spezial$ Word. Doesn't grow.\par}

This Is A \qzctext{Great} Sentence With A $\spezial$ Word.
\end{document}

相关内容