[RISOLTO] Stile del ToC per Front/Backmatter diverso rispetto al Mainmatter

  • Questo topic ha 3 risposte, 2 partecipanti ed è stato aggiornato l'ultima volta 3 anni, 4 mesi fa da Doc.
  • Creatore
    Topic
  • #121609
    Doc
    Partecipante
      Up
      0
      Down
      ::


      Premessa: uso la classe [tt]memoir[/tt] e ho personalizzato il mio ToC con questi parametri:
      `\gappto\captionsitalian{\renewcommand\contentsname{Sommario}}
      \settocdepth{subsubsection}
      % Part
      \renewcommand\thepart{\roman{part}}
      \renewcommand\cftpartpresnum{\scshape}
      \renewcommand\cftpartfont{\scshape}
      \renewcommand\cftpartpagefont{\normalfont}

      % Chapter
      \renewcommand{\chapternumberline}[1]{}
      \renewcommand\cftchapterfont{\scshape}
      \renewcommand\cftchapterpagefont{\normalfont}

      % Section
      \renewcommand\cftsectionpresnum{\scshape}
      \renewcommand\cftsectionfont{\normalfont}
      \renewcommand\cftsectionpagefont{\normalfont}
      %\setlength{\cftbeforesecskip}{.1em}

      % Subsection
      \renewcommand\cftsubsectionpresnum{\scshape}
      \renewcommand\cftsubsectionfont{\normalfont}

      % Subsubsection
      \renewcommand\cftsubsubsectionpresnum{\scshape}
      \renewcommand\cftsubsubsectionfont{\normalfont}

      % Larghezza dello spazio del numero di pagina
      % Utile solo in caso di dots
      \setpnumwidth{2.55em}
      \setrmarg{3.55em}

      % Indentazione
      \cftsetindents{chapter}{0cm}{0cm}
      \cftsetindents{section}{0.5cm}{0.5cm}
      \cftsetindents{subsection}{1cm}{2em}

      % Disabilitare Dots
      \renewcommand{\cftdot}{}`

      Il mio problema è: come fare ad ottenere i capitoli del frontmatter e del backmatter in corsivo, mentre quelli del mainmatter come qui li vedete?
      In pratica, vorrei emulare lo stile delle pubblicazioni della Cambridge University Press, come da questo esempio:
      Link

      Grazie mille in anticipo,
      Domenico

    Visualizzazione 2 filoni di risposte
    • Autore
      Risposte
      • #121610
        Doc
        Partecipante
          Up
          0
          Down
          ::


          Bah! Un sistema l’ho appena trovato:
          `
          % !TeX TS-program = xelatex
          % !TeX encoding = UTF-8 Unicode
          % !TeX spellcheck = it_IT
          % !TeX root = memoir.tex
          % !BIB TS-program = biber

          \documentclass[%
          b5paper,%
          11pt,%
          twoside,%
          ]{memoir}
          %\setlength{\parindent}{0.5cm}
          \usepackage[italian]{babel}

          \gappto\captionsitalian{\renewcommand\contentsname{Sommario}}
          \settocdepth{subsubsection}
          % Part
          \renewcommand\thepart{\roman{part}}
          \renewcommand\cftpartpresnum{\scshape}
          \renewcommand\cftpartfont{\scshape}
          \renewcommand\cftpartpagefont{\normalfont}

          % Chapter
          \renewcommand{\chapternumberline}[1]{}
          \renewcommand\cftchapterfont{\scshape}
          \renewcommand\cftchapterpagefont{\normalfont}

          % Section
          \renewcommand\cftsectionpresnum{\scshape}
          \renewcommand\cftsectionfont{\normalfont}
          \renewcommand\cftsectionpagefont{\normalfont}
          %\setlength{\cftbeforesecskip}{.1em}

          % Subsection
          \renewcommand\cftsubsectionpresnum{\scshape}
          \renewcommand\cftsubsectionfont{\normalfont}

          % Subsubsection
          \renewcommand\cftsubsubsectionpresnum{\scshape}
          \renewcommand\cftsubsubsectionfont{\normalfont}

          % Larghezza dello spazio del numero di pagina
          % Utile solo in caso di dots
          \setpnumwidth{2.55em}
          \setrmarg{3.55em}

          % Indentazione
          \cftsetindents{chapter}{0cm}{0cm}
          \cftsetindents{section}{0.5cm}{0.5cm}
          \cftsetindents{subsection}{1cm}{2em}

          % Disabilitare Dots
          \renewcommand{\cftdot}{}

          \usepackage{lipsum}
          \usepackage{hyperref}

          \begin{document}
          \frontmatter
          \tableofcontents*

          \chapter*{Premessa}
          \addcontentsline{toc}{chapter}{\normalfont\itshape Premessa}
          \lipsum
          \chapter{Info}
          \lipsum

          \mainmatter
          \part{Premesse Generali}
          \chapter{Nozioni di Base}
          \section{Sezione}
          \lipsum

          \section{Sezione 2}
          \subsection{Sottosezione 1}
          \lipsum
          \subsection{Sottosezione 2}
          \lipsum

          \chapter{Capitolo 2}
          \section{Sezione}
          \lipsum
          \section{Sezione}
          \lipsum

          \backmatter
          \chapter{Appendice 1}
          \section{Sezione}
          \lipsum
          \section{Sezione}
          \lipsum
          \chapter{Appendice 2}
          \section{Sezione}
          \lipsum
          \section{Sezione}
          \lipsum
          \section{Sezione}
          \lipsum
          \end{document}
          `

          Ovviamente, se c’è un modo più elegante e pulito, meglio ancora! 8)

        • #121611
          MatteoF
          Partecipante
            Up
            0
            Down
            ::


            Nel preambolo aggiungi:
            `
            \cftinsertcode{frontmattertoc}{\renewcommand*{\cftchapterfont}{\itshape}}
            \preto{\frontmatter}{\cftinserthook{toc}{frontmattertoc}}
            \cftinsertcode{mainmattertoc}{\renewcommand*{\cftchapterfont}{\upshape}}
            \preto{\mainmatter}{\cftinserthook{toc}{mainmattertoc}}
            \cftinsertcode{backmattertoc}{\renewcommand*{\cftchapterfont}{\itshape}}
            \preto{\backmatter}{\cftinserthook{toc}{backmattertoc}}
            `
            Ovviamente dovrai aver caricato [tt]etoolbox[/tt].

            Matteo

          • #121612
            Doc
            Partecipante
              Up
              0
              Down
              ::


              Grazie mille!
              Ho messo [tt]scshape[/tt] nel mainmatter, ma capisco che devo cercare di conoscere meglio questo [tt]etoolbox[/tt], che mi sa essere molto utile!

              EDIT
              La tua soluzione mi ha consentito di comprendere meglio la pagina 161 della documentazinoe di [tt]memoir[/tt]. In breve, pare che la cosa da me richiesta sia possibile anche con gli strumenti interni della classe!
              Ri-grazie!

          Visualizzazione 2 filoni di risposte
          • Devi essere connesso per rispondere a questo topic.

          Go to top