Here is a solution: a \mynorm
with two optional arguments and one mandatory: the first optional argument may be *
(appended to the name of the command) or [\big]
or [\Big]
, &c. The second optional argument is the subscript, in its ‘natural’ position (after the mandatory argument).
However, I suggest another construction with \DeclarePairedDelimiterXPP
for the standard norm, so you don't have to type the subscript. I give commands for the 1-norm, the 2-norm the p-norm and the sup-norm.
\documentclass{article}
\usepackage{mathtools}
\usepackage{xparse, etoolbox}
\newcommand*{\dd}{\mathop{\kern0pt\mathrm{d}}\mkern-2mu{}}
\DeclarePairedDelimiter{\normaux}\lVert\rVert
\NewDocumentCommand\mynorm{somO{}}{%
\IfBooleanTF{#1}
{\normaux*{#3}_{#4}}%
{\IfNoValueTF{#2}{\normaux{#3}_{#4}}{\normaux[#2]{#3}_{#4}}}%
}%
\DeclarePairedDelimiterXPP\onenorm[1]{}\lVert\rVert{_1}{\ifblank{#1}{\:\cdot\:}{#1}}%
\DeclarePairedDelimiterXPP\twonorm[1]{}\lVert\rVert{_2}{\ifblank{#1}{\:\cdot\:}{#1}}
\DeclarePairedDelimiterXPP\pnorm[1]{}\lVert\rVert{_p}{\ifblank{#1}{\:\cdot\:}{#1}}
\DeclarePairedDelimiterXPP\supnorm[1]{}\lVert\rVert{_\infty}{\ifblank{#1}{\:\cdot\:}{#1}}
\begin{document}
$\mynorm{\dfrac XY}[2]\qquad\mynorm*{\dfrac XY}[2]$\bigskip
$\mynorm[\Big]{X^Y}[∞]\qquad\mynorm{X^Y}[2]\qquad\mynorm[\big]{X^Y}$\bigskip
$ \supnorm{f + g} \le \supnorm{f} + \supnorm{g}$\bigskip
$\displaystyle\pnorm{f} = \biggl(\int_0^1 f(t)\dd t \biggr)^{\!\!\frac{1}{p}}$
\end{document}

_{foo}
, I don't see why you would need that with\DeclarePairedDelimiter
.\norm[\infty]{\phi}
. Perfectly reasonable desire IMHO.