antonio.macrì” post=65783Grazie.
In ogni caso, la strategia migliore è quella di scegliere una delle due sintassi e lavorare con quella; supponiamo tu voglia quella di tocloft:
`\ifcth@memoir
\let\cftbeforechapskip\cftbeforechapterskip
…
\fi`
In altre parole definisci una tabella di equivalenze e lavori con i comandi di tocloft. Occupazione di memoria minima e sintassi invariata. Puoi anche ideare facilmente una “metatabella”.Ciao
EnricoCredo di non aver capito. Se faccio
`
\ifcth@memoir
\let\cftbeforechapskip\cftbeforechapterskip
\let\cftsecnumwidth\cftsectionnumwidth
\let\cftsubsecpresnum\cftsubsectionpresnum
…
\fi
\setlength{\cftbeforechapskip}{.1em}
\addtolength{\cftsecnumwidth}{\newchnumberwidth}
\renewcommand{\cftsubsecpresnum}{\scshape\MakeTextLowercase}
…
`
le istruzioni con \setlength e \addtolength funzionano, ma i \renewcommand no (e ce ne sono tanti, sono anzi i più numerosi). Dovrei fare:
`
\ifcth@memoir
\let\cftbeforechapskip\cftbeforechapterskip
\let\cftsecnumwidth\cftsectionnumwidth
\let\cftsubsecpresnum\cftsubsectionpresnum
… % quelli per \setlength, \addtolength e \renewcommand
\fi
\setlength{\cftbeforechapskip}{.1em}
\addtolength{\cftsecnumwidth}{\newchnumberwidth}
\renewcommand{\cftsubsecpresnum}{\scshape\MakeTextLowercase}
…
\ifcth@memoir
\let\cftsubsectionpresnum\cftsubsecpresnum
… % solo quelli per \renewcommand (invertiti)
\fi
`
ma mi pare prolisso. 😕Che metatabella intendi?
Già, con i \renewcommand non funziona: infatti per questi devi dire
`\let\cftsubsecpresnum\cftsubsectionpresnum
\def\cftsubsectionpresnum{\cftsubsecpresnum}`
A questo punto anche \renewcommand{\cftsubsecpresnum}{\scshape\MakeTextLowercase} funzionerà.
La “metatabella” consiste nel definire
`\def\convertmemoirtotocloft#1#2{%
\expandafter\let\csname cftbefore#2skip\expandafter\endcsname\csname cftbefore#1skip\endcsname
…
\expandafter\let\csname cft#2presnum\expandafter\endcsname\csname cft#1presnum\endcsname
\expandafter\def\csname cft#1presnum\expandafter\endcsname\expandafter{\csname cft#2presnum\endcsname}
…
}`
da chiamare come
`\convertmemoirtotocloft{chapter}{chap}`
Si può lievemente migliorare accorgendosi che la struttura è molto simile:
`\def\convertmemoirtotocloftlet#1#2#3#4{%
\expandafter\let\csname cft#1#4#2\expandafter\endcsname\csname cft#1#3#2\endcsname}
\def\convertmemoirtotocloftdef#1#2#3#4{%
\convertmemoirtotocloftlet{#1}{#2}{#3}{#4}%
\expandafter\def\csname cft#1#3#2\expandafter\endcsname\expandafter{\csname cft#1#4#2\endcsname}`
e il codice di prima diventerebbe
`\def\convertmemoirtotocloft#1#2{%
\convertmemoirtotocloftlet{before}{skip}{#1}{#2}
…
\convertmemoirtotocloftdef{}{presnum}{#1}{#2}
…
}`
Al posto dei puntini metti tutti i comandi necessari e ti basterà dire
`\ifcth@memoir
\convertmemoirtotocloft{chapter}{chap}
\convertmemoirtotocloft{section}{sec}
…
\fi`
Ciao
Enrico