1

In the code below, the numeric superscript and subscript do not scale correctly or looks "not nice" when the font is scaled down. Is there a way to have the superscript and subscript scale nicely or is this presentable?:

enter image description here

This is the code that I am testing out:

CODE

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usepackage[most]{tcolorbox}

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

\DeclareMathOperator{\di}{d\!}
\newcommand*\Eval[3]{\left.#1\right\rvert_{#2}^{#3}}

%======================================================================================
%   FONTS
%======================================================================================
\usepackage{unicode-math}  % loads 'fontspec' automatically

\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}}}

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
  title=#2,colback=white}

%%------------ AM: Double Sideband Large Carrier ---------------
\hspace*{0.07cm}
\begin{minipage}{0.30\textwidth}

    \begin{mybox}{AM: Double Sideband Large Carrier [DSB-LC\text{]}}
\hspace*{-0.5cm}\tiny{Pwr Eff:} $\eta=\frac{\text{Pwr in DSB-SC Side Bands}}{\text{Total Pwr in AM Signal}}=\dfrac{\frac{1}{2}K^{2}_{a}A^{2}_{c}\overline{m^{2}(t)}}{\frac{1}{2}A^{2}_{c}+\frac{1}{2}%
k^{2}_{a}A^{2}_{c}\overline{m^{2}(t)}}=\dfrac{\overline{m^{2}(t)}}{1/k^{2}_{a}+\overline{m^{2}(t)}}\quad
=\frac{\overline{m^{2}(t)}}{A^{2}+\overline{m^{2}(t)}}=\fbox{$\frac{\mu^{2}}{2+\mu^{2}}$}$

    \end{mybox}
\end{minipage}

\end{multicols*}
\end{document}
  • Please tell us whether you use XeLaTeX or LuaLaTeX to compile your document. – Mico Oct 30 '18 at 5:29
  • Aside: Why do you load the geometry page layout package and then use low-level TeX directives to set the dinensions of the textblock? – Mico Oct 30 '18 at 5:32
  • I use XeLaTeX to compile my document. Thanks! – Joe Oct 30 '18 at 5:32
  • 1
    Well, \tiny fonts don't scale down in subscripts and superscripts. – Sergei Golovan Oct 30 '18 at 5:36
  • 2
    Mico is pointing out that your markup is wrong: \tiny{Pwr Eff:} makes the rest of the document (or current scope) tiny, not just Pwr Eff: the {} are doing nothing there, – David Carlisle Oct 30 '18 at 7:54
2

enter image description here

It looks like the math is only at \tiny size due to an error in the markup for

{\tiny Pwr Eff:}

However if you do really want fonts that small declare the subscript and sussubscript sizes using \DeclareMathSize, shown in teh second version below.

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usepackage[most]{tcolorbox}

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

\DeclareMathOperator{\di}{d\!}
\newcommand*\Eval[3]{\left.#1\right\rvert_{#2}^{#3}}

%======================================================================================
%   FONTS
%======================================================================================
\usepackage{unicode-math}  % loads 'fontspec' automatically


\parindent0pt
\parskip2pt
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\DeclareMathSizes{5}{5}{3}{2.5}% really?

\begin{document}

\begin{multicols*}{3}

\newtcolorbox{mybox}[2][]{text width=0.97\textwidth,fontupper=\scriptsize,
fonttitle=\bfseries\sffamily\scriptsize, colbacktitle=black,enhanced,
attach boxed title to top left={yshift=-2mm,xshift=3mm},
boxed title style={sharp corners},top=3pt,bottom=2pt,
  title=#2,colback=white}

%%------------ AM: Double Sideband Large Carrier ---------------

\begin{minipage}{0.30\textwidth}

    \begin{mybox}{AM: Double Sideband Large Carrier [DSB-LC\text{]}}
\hspace*{-0.5cm}{\tiny Pwr Eff:}
$\eta=\frac{\text{Pwr in DSB-SC Side Bands}}{\text{Total Pwr in AM Signal}}=
\dfrac{\frac{1}{2}K^{2}_{a}A^{2}_{c}\overline{m^{2}(t)}}{\frac{1}{2}A^{2}_{c}+\frac{1}{2}%
k^{2}_{a}A^{2}_{c}\overline{m^{2}(t)}}=\dfrac{\overline{m^{2}(t)}}{1/k^{2}_{a}+\overline{m^{2}(t)}}\quad
=\frac{\overline{m^{2}(t)}}{A^{2}+\overline{m^{2}(t)}}=\fbox{$\frac{\mu^{2}}{2+\mu^{2}}$}$

    \end{mybox}
\end{minipage}

\begin{minipage}{0.30\textwidth}

    \begin{mybox}{AM: Double Sideband Large Carrier [DSB-LC\text{]}}
\hspace*{-0.5cm}\tiny Pwr Eff:
$\eta=\frac{\text{Pwr in DSB-SC Side Bands}}{\text{Total Pwr in AM Signal}}=
\dfrac{\frac{1}{2}K^{2}_{a}A^{2}_{c}\overline{m^{2}(t)}}{\frac{1}{2}A^{2}_{c}+\frac{1}{2}%
k^{2}_{a}A^{2}_{c}\overline{m^{2}(t)}}=\dfrac{\overline{m^{2}(t)}}{1/k^{2}_{a}+\overline{m^{2}(t)}}\quad
=\frac{\overline{m^{2}(t)}}{A^{2}+\overline{m^{2}(t)}}=\fbox{$\frac{\mu^{2}}{2+\mu^{2}}$}$

    \end{mybox}
\end{minipage}


\end{multicols*}
\end{document}
1

The use of \tiny, which affects the entire rest of the box, is the main cause the problem. I don't think it's even necessary to employ \tiny.

Since you're loading the geometry package anyway, I would set an option such as margin=3mm rather than employ five \advance statements to modify some low-level text block parameters.

And, since you're loading the mathtools package, do consider using an aligned environment to typeset the two-line equation. By using an aligned environment, you'll also have much better and direct control over where the line breaks in the formula will occur. In particular, the line breaks will no longer be at the mercy of the width of the chosen minipage environment.

The following screenshot shows the outputs of your original code and of some code that implements the suggestions made above. Incidentally, I had to comment out the commands that load the text fonts since these fonts don't appear to be installed on my system.

enter image description here

\documentclass{article}
\usepackage[landscape,margin=3mm]{geometry}
%\advance\topmargin-1in
%\advance\textheight3in
%\advance\textwidth3in
%\advance\oddsidemargin-1.5in
%\advance\evensidemargin-1.5in

\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{multicol,lipsum}
\usepackage{amssymb,amsthm}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}[2][]{%
   text width=0.97\textwidth,
   fontupper=\scriptsize,
   fonttitle=\bfseries\sffamily\scriptsize,
   colbacktitle=black,enhanced,
   attach boxed title to top left={yshift=-2mm,xshift=3mm},
   boxed title style={sharp corners},
   top=3pt,bottom=2pt,
   title=#2,colback=white}

\makeatletter
\newcommand*\bigcdot{\mathpalette\bigcdot@{.5}}
\newcommand*\bigcdot@[2]{%
   \mathbin{\vcenter{\hbox{\scalebox{#2}{$\m@th#1\bullet$}}}}}
\makeatother
\DeclareMathOperator{\di}{d\!}
\newcommand*\Eval[3]{\left.#1\right\rvert_{#2}^{#3}}

%============================================================
%   FONTS
%============================================================
\usepackage{unicode-math}  % loads 'fontspec' automatically

%%% I've commented out the following lines since the 
%%% the text fonts aren't installed on my system.
%\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

\setlength{\parindent}{0pt}
\setlength{\parskip}{2pt}
\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}}

\begin{document}

\begin{multicols*}{3}

%% ------ AM: Double Sideband Large Carrier ------
%\hspace*{0.07cm}
\begin{minipage}{0.3\textwidth}
\begin{mybox}{AM: Double Sideband Large Carrier [DSB-LC\text{]}}
\hspace*{-0.5cm}
\tiny{Pwr Eff:} $\eta=\frac{\text{Pwr in DSB-SC Side Bands}}{\text{Total Pwr in AM Signal}}=\dfrac{\frac{1}{2}K^{2}_{a}A^{2}_{c}\overline{m^{2}(t)}}{\frac{1}{2}A^{2}_{c}+\frac{1}{2}%
k^{2}_{a}A^{2}_{c}\overline{m^{2}(t)}}=\dfrac{\overline{m^{2}(t)}}{1/k^{2}_{a}+\overline{m^{2}(t)}}\quad
=\frac{\overline{m^{2}(t)}}{A^{2}+\overline{m^{2}(t)}}=\fbox{$\frac{\mu^{2}}{2+\mu^{2}}$}$
\end{mybox}
\end{minipage}

\bigskip
\begin{minipage}{0.9\columnwidth}
\begin{mybox}{AM: Double Sideband Large Carrier [DSB-LC{]}}
%\hspace*{-0.5cm}
Pwr Eff:\quad
$\begin{aligned}[t]
\eta
&= \frac{\text{Pwr in DSB-SC Sidebands}}{%
         \text{Total Pwr in AM Signal}}
 = \frac{\frac{1}{2}K^2_aA^2_c\,\overline{m^2(t)}}{%
         \frac{1}{2}A^2_c +\frac{1}{2}k^2_a A^2_c\,\overline{m^2(t)}}\\
&= \frac{\overline{m^2(t)}}{1/k^2_a +\overline{m^2(t)}}
 = \frac{\overline{m^2(t)}}{A^2 +\overline{m^2(t)}}
 = \fbox{$\dfrac{\mu^2}{2+\mu^2}$}
\end{aligned}$
\end{mybox}
\end{minipage}

\end{multicols*}
\end{document} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.