如何缩放内联数学模式字体

如何缩放内联数学模式字体

我想知道如何在积分极限和下面给出的代码中的幂上缩放文本的大小:

在此处输入图片描述

我使用了命令\DeclareMathSizes{10.95}{10}{7}{7}我使用了给定的这里但字体没有变化。谢谢你的帮助!

代码

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{url}
\usepackage{multicol}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{esint}
\usepackage{amsfonts}
\usepackage{blox}
\usepackage{tikz}
\usetikzlibrary{quotes, decorations.pathmorphing, shapes, arrows.meta}

\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{enumitem}

\makeatletter
\newcommand*\bigcdot{\mathpalette\bigcdot@{.5}}
\newcommand*\bigcdot@[2]{\mathbin{\vcenter{\hbox{\scalebox{#2}{$\m@th#1\bullet$}}}}}
\makeatother

%======================================================================================
%   FONTS
%======================================================================================

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       Font
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
% For source code
\setmonofont{Source Code Pro Light}[
BoldFont=Source Code Pro,
]
% Normal font
\setsansfont{Fira Sans Light}[
Numbers=OldStyle,
BoldFont=Fira Sans Medium,
ItalicFont=Fira Sans Light Italic,
BoldItalicFont=Fira Sans Medium Italic
]
% Normal font
\setmainfont{Fira Sans Light}[
Numbers=OldStyle,
BoldFont=Fira Sans Medium,
ItalicFont=Fira Sans Light Italic,
BoldItalicFont=Fira Sans Medium Italic
]

\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}
%\colorbox[HTML]{e4e4e4}{\makebox[\textwidth-2\fboxsep][l]{texto}
\begin{document}

{\textbf{Communications Systems}}\\
Z23367851
\begin{multicols*}{3}

\tikzstyle{mybox} = [draw=black, fill=white, very thick, font=\tiny,
    rectangle, rounded corners, inner sep=10pt, inner ysep=10pt]
\tikzstyle{fancytitle} =[fill=black, text=white, font=\scriptsize\bfseries]

%------------ Bandwidth and Noise ---------------
\begin{tikzpicture}
\node [mybox] (box){%
    \begin{minipage}{0.3\textwidth}
    A band limited signal cannot be time limited and a time-limited signal cannot be band limited.\\
    \end{minipage}
};
%------------ Bandwidth and Noise Header ---------------------
\node[fancytitle, right=10pt] at (box.north west) {Bandwidth and Noise};
\end{tikzpicture}

%------------ Energy ---------------
\begin{tikzpicture}
\node [mybox] (box){%
    \begin{minipage}{0.3\textwidth}
        Energy $E = \int\limits_{\infty}^{-\infty}|x(t)|^{2}dt$ if $E$ is finite\\
        Power $P=\lim\limits_{T \to \infty}\frac{1}{T}\int\limits_{T/2}^{-T/2}|x(t)|^{2}dt$
    \end{minipage}
};
%------------ Energy Header ---------------------
\node[fancytitle, right=10pt] at (box.north west) {Energy};
\end{tikzpicture}
\end{multicols*}
\end{document}

答案1

不要使用font=\tiny,因为它不会让你满意地排版下标和上标材料。最多使用font=\scriptsize;此建议基于您的代码仅包含一级下标和上标材料的事实。如果它包含二级下标和上标材料,我会font=...完全省略该选项。

在内联文本模式下使用\int\limits肯定是印刷上的不妥。\int请不要使用\limits

单独加载colortblxcolor包是一个常见错误。不要这样做;\usepackage[table]{xcolor}而是写。

关于其他一些包:如果加载了 ,则会amsfonts自动加载包;如果 加载了 ,则会自动加载包。因此,无需显式加载。同样,也会由包自动加载。amssymbamsmathmathtoolsamsmathamsfontsfontspecunicode-math

默认数学字体 Latin Modern Math 字体系列与 的协调性不是很好Fira SansAsana Math试试看。

我无法弄清楚使用multicols*环境应该实现什么;下面的代码在没有这个环境的情况下也可以完成。

在此处输入图片描述

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{url}
%%\usepackage{multicol} % doesn't seem to be needed
\usepackage{mathtools,amssymb,amsthm}
%%\usepackage{esint}  % is this needed?
\usepackage[table]{xcolor} % load 'colortbl' in way that maximizes compatibility with 'xcolor'

\usepackage{blox}
\usepackage{tikz}
\usetikzlibrary{quotes, decorations.pathmorphing, shapes, arrows.meta}
\usepackage{enumitem}

\makeatletter
\newcommand*\bigcdot{\mathpalette\bigcdot@{.5}}
\newcommand*\bigcdot@[2]{\mathbin{\vcenter{\hbox{\scalebox{#2}{$\m@th#1\bullet$}}}}}
\makeatother

%=====================================
%   FONTS
%=====================================

\usepackage{unicode-math}  % loads 'fontspec' automatically
%\defaultfontfeatures{Ligatures=TeX} % 'Ligatures=TeX' is the default 
% Normal font
\setmainfont{Fira Sans Light}[
     Numbers       = OldStyle,
     BoldFont      = Fira Sans Medium,
     ItalicFont    = Fira Sans Light Italic,
     BoldItalicFont= Fira Sans Medium Italic]
\setsansfont{Fira Sans Light}[
     Numbers       = OldStyle,
     BoldFont      = Fira Sans Medium,
     ItalicFont    = Fira Sans Light Italic,
     BoldItalicFont= Fira Sans Medium Italic]
% For source code
\setmonofont{Source Code Pro Light}[
     BoldFont=Source Code Pro]

%% Math font
\setmathfont{Asana Math} % or some other suitable font

\advance\topmargin-1in
\advance\textheight3in
\advance\textwidth3in
\advance\oddsidemargin-1.5in
\advance\evensidemargin-1.5in
\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}
%\colorbox[HTML]{e4e4e4}{\makebox[\textwidth-2\fboxsep][l]{texto}

\tikzstyle{mybox} = [draw=black, fill=white, very thick, font=\scriptsize,
    rectangle, rounded corners, inner sep=10pt, inner ysep=10pt]
\tikzstyle{fancytitle} =[fill=black, text=white, font=\scriptsize\bfseries]

\begin{document}
\textbf{Communications Systems}\\
Z23367851

%%\begin{multicols*}{3} %% What's the purpose of this instruction?

\bigskip
%------- Bandwidth and Noise ---------------
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.3\textwidth}
A band limited signal cannot be time limited and 
a time limited signal cannot be band limited.
\end{minipage}
};
%------- Bandwidth and Noise Header ----------
\node[fancytitle, right=10pt] at (box.north west) {Bandwidth and Noise};
\end{tikzpicture}

%------- Energy ------------------------------
\begin{tikzpicture}
\node [mybox] (box){%
\begin{minipage}{0.3\textwidth}
Energy $E = \int_{\infty}^{-\infty}|x(t)|^{2}dt$ if $E$ is finite

Power $P=\lim\limits_{T \to \infty}\frac{1}{T}
   \int_{T/2}^{-T/2}\lvert x(t)\rvert^{2}dt$
\end{minipage}
};
%--------- Energy Header --------------------
\node[fancytitle, right=10pt] at (box.north west) {Energy};
\end{tikzpicture}

%%\end{multicols*}
\end{document}

答案2

您的默认数学字体未正确缩放到主文档字体。由于您fontspec无论如何都要加载,因此只需加载unicode-math,在加载数学字体Scale=MatchUppercase后使用\setmainfont,就可以了。

更大的问题(没有双关语的意思)是 LaTeX 不会将上标和下标缩小到 1.25 点。我将小页面的字体大小增加到\footnotesize并将其宽度调整到匹配。

我在这里对您的源代码进行了一些改动,包括用您的文本字体替换数学字母。如果您不想要,请注释掉指示的行。您可以尝试在包选项中增加字体大小。我还添加了在环境\textstyle中使用的选项amsmath,并更改了一些分数。绝对值条现在是拉伸的左右分隔符,d 中的 d正确直立且间隔适当。

\documentclass[varwidth, preview, 10pt]{standalone}

\usepackage{mathtools}    % includes amsmath
\usepackage{xfrac}        % for \sfrac
\usepackage{unicode-math} % includes fontspec, all symbols in Unicode
\usepackage[cols, HTML, hyperref, svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{quotes, decorations.pathmorphing, shapes, arrows.meta}

% Normal font
  \setmainfont{Fira Sans Light}[
  Numbers=OldStyle,
  BoldFont=Fira Sans Medium,
  ItalicFont=Fira Sans Light Italic,
  BoldItalicFont=Fira Sans Medium Italic,
  Ligatures={Common, Rare, TeX}
]

\defaultfontfeatures{Scale=MatchUppercase}

% Normal font
\setsansfont{Fira Sans Light}[
  Numbers=OldStyle,
  BoldFont=Fira Sans Medium,
  ItalicFont=Fira Sans Light Italic,
  BoldItalicFont=Fira Sans Medium Italic,
  Ligatures={Common, Rare, TeX}
]

% For source code
\setmonofont{Source Code Pro Light}[
  BoldFont=Source Code Pro,
  Ligatures=TeX
]

% The correctly-scaled math font
\setmathfont{Latin Modern Math}

% Comment out if you want to keep the Latin Modern math letters.
% Alternatively, there's a Fira Math project that's a work in progress.
\setmathfont{Fira Sans Light}[range={up,\infty}]
\setmathfont{Fira Sans Medium}[range=bfup]
\setmathfont{Fira Sans Light Italic}[range=it]
\setmathfont{Fira Sans Medium Italic}[range=bfit]

\setoperatorfont{\normalfont}

% Convenience macros:
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\newcommand\dx[1]{\,\symup{d}{#1}}

\begin{document}

{\textbf{Communications Systems}}\\
Z23367851

\tikzstyle{mybox} = [draw=black, fill=white, very thick,
    rectangle, rounded corners, inner sep=10pt, inner ysep=10pt,
    font=\footnotesize]
\tikzstyle{fancytitle} =[fill=black, text=white,font=\bfseries]

%------------ Bandwidth and Noise ---------------
\begin{tikzpicture}
\node [mybox] (box){%
    \begin{minipage}{0.4\textwidth}
    A band-limited signal cannot be time-limited and a time-limited signal cannot be band-limited.
    \end{minipage}
};
%------------ Bandwidth and Noise Header ---------------------
\node[fancytitle, right=10pt] at (box.north west) {Bandwidth and Noise};
\end{tikzpicture}

%------------ Energy ---------------
\begin{tikzpicture}
\node [mybox] (box){%
    \begin{minipage}{0.4\textwidth}
    \begin{align*}
      \text{Energy } E &=
        \textstyle\int\limits_{\infty}^{-\infty} \abs{x(t)}^{2}\dx{t}
        \text{ if \(E\) is finite}\\
      \text{Power } P &=
        \lim\limits_{T \to \infty}\frac{1}{T}
        \textstyle\int\limits_{\sfrac{T}{2}}^{ \sfrac{-T}{2}} 
        \abs{x(t)}t^{2}\dx{t}
    \end{align*}
    \end{minipage}
};
%------------ Energy Header ---------------------
\node[fancytitle, right=10pt] at (box.north west) {Energy};
\end{tikzpicture}
\end{document}

在此处输入图片描述

如果您有兴趣,Fira Math 字体也正在开发中。如果您仍想调整上标和下标的设置,您可以在 的选项中添加script-features=和设置,包括。sscript-features=\setmathfontScale=

相关内容