Quanto all’approccio da usare, ti suggerirei l’idea di annidare le definizioni nei condizionali \ifsuftesi@<...>, e non viceversa, tanto tutte le condizioni di questo tipo non cambiano nelle diverse invocazioni dei comandi. Così sveltisci la compilazione. Anziché
`
\def\sufthepage{\ifsuftesi@sctitles\sufsc{\thepage}\else\thepage\fi}
`
farei:
`
\ifsuftesi@sctitles
\def\sufthepage{\sufsc{\thepage}}
\else
\let\sufthepage\thepage
\fi`
Un po’ più difficile è riscrivere:
`
\def\sufrightmark{\ifsuftesi@sctitles\sufsc{\ifsuftesi@authortitle\@title\else\rightmark\fi}% article mode
\else\ifsuftesi@authortitle\nouppercase\@title\else\nouppercase\rightmark\fi\fi}
\def\sufleftmark{\ifsuftesi@sctitles\sufsc{\ifsuftesi@authortitle\@author\else\ivanleftmark\fi}% book mode
\else\ifsuftesi@authortitle\nouppercase\@author\else\nouppercase\ivanleftmark\fi\fi}
`
Si può provare:
`
\begingroup
\ifsuftesi@sctitles
\def\cmd{\sufsc}
\else
\def\cmd{\nouppercase}
\fi
\ifsuftesi@authortitle
\def\right{\@title}
\def\left{\@author}
\else
\def\right{\rightmark}
\def\left{\ivanleftmark}
\fi
\expandafter\expandafter\expandafter\gdef\expandafter\expandafter\expandafter\sufrightmark
\expandafter\expandafter\expandafter{\expandafter\cmd\right}
\expandafter\expandafter\expandafter\gdef\expandafter\expandafter\expandafter\sufleftmark
\expandafter\expandafter\expandafter{\expandafter\cmd\left}
\endgroup
`
A parte la caterva di \expandafter, forse mi pare un po’ più leggibile :shock::shock:
Comunque è più flessibile in caso modifichi o ci metti altre opzioni (ma so che non vuoi farlo :)), basta cambiare \cmd, \left e \right.
Gli expandafter servono anche a evitare di conservare variabili temporanee. Un’altra cosa che mi sento di consigliarti è usare prefissi come suf@ per i comandi che non dovranno essere usati dall’utente (come per esempio \ivanleftmark, credo).
Comunque sarebbe bene sentire l’opinione di qualche luminare, sicuramente. Io sono solo uno interessato (molto) a queste cose e che si diletta ogni tanto: se vengo smentito imparo qualcosa. 🙂
Ciao,
A.