1

Some time ago I wrote a command that I used many times, today I realize that it could be written correctly. in particular, the command is selected as "not in a mathematical environment". I looked for other solutions but I do not like them.

I see writing pleasant, but can this command create problems? could you give me a suggestion to write it correctly? Thank you

\documentclass[a4paper]{article} 

\usepackage[T1]{fontenc} 
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage{mwe} 

\usepackage{scalerel}
\newcommand\scale[2]{\vstretch{#1}{\hstretch{#1}{#2}}}
\newcommand\ssp[1]{#1^{\scale{.8}{\scriptstyle{\prime}}}} 
\newcommand\sspp[1]{#1^{\scale{.8}{\scriptstyle{\prime\prime}}}}

\begin{document}

\begin{minipage}[t]{.5\textwidth}
    \begin{align}
    \ssp{z_G}\\
    \sspp{z_{G}}
    \end{align}
\end{minipage}
\begin{minipage}[t]{.5\textwidth}
    \begin{align}
    \ssp{G}\\
    \sspp{G}
    \end{align}
\end{minipage}\\

\end{document}

enter image description here

Antonio
  • 543
  • Wouldn't it be easier just to redefine your math alphabet with smaller scripts, rather than trying to scale each invocation of a script? – Steven B. Segletes Feb 21 '19 at 20:20
  • @Steven I am very inexperienced, could you give me an example? thanks – Antonio Feb 21 '19 at 20:23
  • why not use the standard definitions? \newcommand\ssp[1]{#1'} \newcommand\sspp[1]{#1''} – David Carlisle Feb 21 '19 at 21:17
  • @DavidCarlisle a question of size. using the \scale command I found a nice size for reading and for printing. the problem is certainly the unspecified command in the proper way and the position of the quotes in some conditions – Antonio Feb 22 '19 at 10:32

1 Answers1

2

I asked in a comment: "Wouldn't it be easier just to redefine your math alphabet with smaller scripts, rather than trying to scale each invocation of a script?" The OP asked how.

\DeclareMathSizes is the command that you can define math script sizes, etc. Take this basic code and look at the output:

\documentclass{article}
\usepackage{lmodern}
\begin{document}
\centering
\[
z'_G\quad z''_{G_G}\quad G'\quad G''
\]
Inline: $\frac{x}{y}$
\end{document}

enter image description here

Now (I'm not sure I am setting all the parameters correctly), compare:

\documentclass{article}
\usepackage{lmodern}
\makeatletter
\DeclareMathSizes{\@xpt}{\@xpt}{5}{4}
\DeclareMathSizes{\@xipt}{\@xipt}{6}{5}
\DeclareMathSizes{\@xiipt}{\@xiipt}{6}{5}
\DeclareMathSizes{\@xivpt}{\@xivpt}{\@xpt}{6}
\makeatother
\begin{document}
\centering
\[
z'_G\quad z''_{G_G}\quad G'\quad G''
\]
Inline: $\frac{x}{y}$
\end{document}

enter image description here

The script sizes are smaller. Also, the lmodern package allows for the rendering of the very small math sizes, so you will need that.