# Problem with newcommand subscrip doubleprime

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}


• 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
• @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

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}


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}


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

• Elegant solution is much more comfortable. there are many things to learn – Antonio Feb 22 '19 at 10:49
• @Antonio See this question, tex.stackexchange.com/questions/8434/…, for more details. – Steven B. Segletes Feb 22 '19 at 10:52
• in order to reduce some superscript and subscript I had to create some personal commands. using the media you showed me can greatly reduce the number of personal commands. – Antonio Feb 22 '19 at 11:34
• @Antonio Glad to have helped. – Steven B. Segletes Feb 22 '19 at 11:40