Titlesec e titletoc (prima puntata)

  • Creatore
    Topic
  • #93482
    samiel
    Partecipante
      Up
      0
      Down
      ::


      COn questo codice
      `\documentclass[a4paper,twoside,11pt]{report}
      \usepackage{fontspec}
      \usepackage{polyglossia}
      \setmainlanguage[babelshorthands=true]{italian}
      \PolyglossiaSetup{italian}{indentfirst=false}
      \usepackage{microtype}

      \usepackage{titlesec}
      \renewcommand{\thechapter}{\scshape\roman{chapter}}
      \titleformat{\chapter}[display]
      {\normalfont\fontsize{11pt}{12pt}\selectfont}{thechapter}{0pt}{}
      %%{\normalfont\fontsize{11pt}{12pt}\selectfont}{\chaptertitlename\space \thechapter}{11pt}{}
      \renewcommand\thesection{\arabic{section}}
      \titleformat{\section}
      {\normalfont\fontsize{11pt}{12pt}\selectfont}{\thesection}{0pt}{}
      \titleformat{\subsection}
      {\normalfont\fontsize{11pt}{12pt}\selectfont\itshape}{}{0pt}{}
      \titlespacing{\chapter}{0pt}{0pt}{3cm}

      \usepackage{titletoc}

      \begin{document}
      \tableofcontents

      \chapter{Some text title 1}
      Some text some text some text some text some text

      \chapter{Some text title 2}
      Some text some text some text some text some text

      \chapter{Some title 3}
      Some text some text some text some text some text

      \end{document}`
      ottengo tutto quanto mi serve tranne un dettaglio: nell’indice i numeri dei capitolo
      (\scshape\roman) in realtà sono minuscoli. Pasticciando col codice, mi pareva
      di essere riuscito a renderli come desidero senza ricorrere a titletoc, ma adesso
      non ne sono più certo. Cosa devo correggere?

      grazie
      m

    Visualizzazione 6 filoni di risposte
    • Autore
      Risposte
      • #93483
        Up
        0
        Down
        ::

        samiel” post=93122COn questo codice
        `\documentclass[a4paper,twoside,11pt]{report}
        \usepackage{fontspec}
        \usepackage{polyglossia}
        \setmainlanguage[babelshorthands=true]{italian}
        \PolyglossiaSetup{italian}{indentfirst=false}
        \usepackage{microtype}

        \usepackage{titlesec}
        \renewcommand{\thechapter}{\scshape\roman{chapter}}
        \titleformat{\chapter}[display]
        {\normalfont\fontsize{11pt}{12pt}\selectfont}{thechapter}{0pt}{}
        %%{\normalfont\fontsize{11pt}{12pt}\selectfont}{\chaptertitlename\space \thechapter}{11pt}{}
        \renewcommand\thesection{\arabic{section}}
        \titleformat{\section}
        {\normalfont\fontsize{11pt}{12pt}\selectfont}{\thesection}{0pt}{}
        \titleformat{\subsection}
        {\normalfont\fontsize{11pt}{12pt}\selectfont\itshape}{}{0pt}{}
        \titlespacing{\chapter}{0pt}{0pt}{3cm}

        \usepackage{titletoc}

        \begin{document}
        \tableofcontents

        \chapter{Some text title 1}
        Some text some text some text some text some text

        \chapter{Some text title 2}
        Some text some text some text some text some text

        \chapter{Some title 3}
        Some text some text some text some text some text

        \end{document}`
        ottengo tutto quanto mi serve tranne un dettaglio: nell’indice i numeri dei capitolo
        (\scshape\roman) in realtà sono minuscoli. Pasticciando col codice, mi pareva
        di essere riuscito a renderli come desidero senza ricorrere a titletoc, ma adesso
        non ne sono più certo. Cosa devo correggere?

        grazie
        m

        Devi impostare le varie voci dell’indice con i comandi di titletoc,
        Che carichi ma di fatto non usi.

        Ciao
        Ivan

      • #93484
        samiel
        Partecipante
          Up
          0
          Down
          ::


          Ho provato con questo codice:
          `\documentclass[a4paper]{report}
          \usepackage[T1]{fontenc}
          \usepackage[utf8]{inputenc}
          \usepackage[italian]{babel}
          \usepackage{cfr-lm}

          \usepackage{titlesec}
          \renewcommand{\thechapter}{\scshape\roman{chapter}}
          \titleformat{\chapter}[display]
          {\normalfont\fontsize{11pt}{12pt}\selectfont}{\thechapter}{0pt}{}
          %%{\normalfont\fontsize{11pt}{12pt}\selectfont}{\chaptertitlename\space \thechapter}{11pt}{}
          \renewcommand\thesection{\arabic{section}}
          \titleformat{\section}
          {\normalfont\fontsize{11pt}{12pt}\selectfont}{\thesection}{1em}{}
          \titleformat{\subsection}
          {\normalfont\fontsize{11pt}{12pt}\selectfont\itshape}{}{1em}{}
          \titlespacing{\chapter}{0pt}{0pt}{3cm}

          \usepackage{titletoc}
          \titlecontents{chapter}
          [1.5em] % ie, 1.5em (chapter) + 2.3em
          {}
          {\contentslabel{2.3em}}
          {\hspace*{-2.3em}}
          {}
          %{\titlerule*[1pc]{.}\contentspage}

          \begin{document}
          \tableofcontents

          \chapter{Chapter 1 title}
          Some text some text some text some text some text

          \section{Section a title}
          Some text some text some text some text some text

          \section{Section b title}
          Some text some text some text some text some text

          \chapter{Chapter 2 title}
          Some text some text some text some text some text

          \section{Section c title}
          Some text some text some text some text some text

          \section{Section d title}
          Some text some text some text some text some text

          \chapter{Chapter 3 title}
          Some text some text some text some text some text

          \section{Section e title}
          Some text some text some text some text some text

          \section{Section f title}
          Some text some text some text some text some text
          \end{document}`
          Le due cose che nell’indice non funzionano sono:
          1) Come far sì che il numero della pagina non erediti il \fontnotesize del titolo, ma sia
          di normali dimensioni, cioè come il testo? A meno di non eliminare il numero di pagina
          del capitolo, come attualmente ho fatto…
          2) Infine: come allineare i numeri (romani) dei capitoli a destra, e non come sono attualmente,
          e cioè a sinistra?

        • #93485
          samiel
          Partecipante
            Up
            0
            Down
            ::


            Mettendo da parte entrambi ii quesiti del precedente post,
            il mio obiettivo è mantenere quell’aspetto con una fondamentale variante:
            avere i numeri di pagina allineati a destra. Per rendere l’idea,
            allego un indice la cui formattazione vorrei riprodurre

            Ora, c’è un conflitto tra il codice prodotto da Pignalberi
            e cioè il seguente per allineare i numeri a sinistra
            `\usepackage{titletoc}
            \contentsmargin{0pt}
            \titlecontents{chapter}[4pc]
            {\contentsmargin{0pt}\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][l]%
            {\textsc{\romannumeral\thecontentslabel\ quad}}}}
            {}
            {}
            {}`
            e quello per riformattare l’indice e i titoli dei capitoli che ho prodotto nel post precedente.
            Aggiungendo semplicemente i due codici viene fuori un’accozzaglia ingestibile:
            `\documentclass[a4paper]{report}
            \usepackage[T1]{fontenc}
            \usepackage[utf8]{inputenc}
            \usepackage[italian]{babel}
            \usepackage{cfr-lm}

            \usepackage{titlesec}
            \renewcommand{\thechapter}{\scshape\roman{chapter}}
            \titleformat{\chapter}[display]
            {\normalfont\fontsize{11pt}{12pt}\selectfont}{\thechapter}{0pt}{}
            %%{\normalfont\fontsize{11pt}{12pt}\selectfont}{\chaptertitlename\space \thechapter}{11pt}{}
            \renewcommand\thesection{\arabic{section}}
            \titleformat{\section}
            {\normalfont\fontsize{11pt}{12pt}\selectfont}{\thesection}{1em}{}
            \titleformat{\subsection}
            {\normalfont\fontsize{11pt}{12pt}\selectfont\itshape}{}{1em}{}
            \titlespacing{\chapter}{0pt}{0pt}{3cm}

            \usepackage{titletoc}
            \titlecontents{chapter}
            [1.5em] % ie, 1.5em (chapter) + 2.3em
            {}
            {\contentslabel{2.3em}}
            {\hspace*{-2.3em}}
            {}
            %{\titlerule*[1pc]{.}\contentspage}

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            % codice Pignalberi
            \contentsmargin{0pt}
            \titlecontents{chapter}[4pc]
            {\contentsmargin{0pt}\makebox[0pt][r]{\thecontentspage\quad\makebox[30pt][l]%
            {\textsc{\romannumeral\thecontentslabel\ quad}}}}
            {}
            {}
            {}
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

            \begin{document}
            \tableofcontents

            \chapter{Chapter 1 title}
            Some text some text some text some text some text

            \section{Section a title}
            Some text some text some text some text some text

            \section{Section b title}
            Some text some text some text some text some text

            \chapter{Chapter 2 title}
            Some text some text some text some text some text

            \section{Section c title}
            Some text some text some text some text some text

            \section{Section d title}
            Some text some text some text some text some text

            \chapter{Chapter 3 title}
            Some text some text some text some text some text

            \section{Section e title}
            Some text some text some text some text some text

            \section{Section f title}
            Some text some text some text some text some text
            \end{document}`
            Purtroppo, la sezione del manuale dedicata a titletoc non è particolarmente ampia…
            Come si può risistemare questo codice?

            grazie
            m

          • #93486
            Up
            0
            Down
            ::

            samiel” post=93125Ho provato con questo codice:
            `\documentclass[a4paper]{report}
            \usepackage[T1]{fontenc}
            \usepackage[utf8]{inputenc}
            \usepackage[italian]{babel}
            \usepackage{cfr-lm}

            \usepackage{titlesec}
            \renewcommand{\thechapter}{\scshape\roman{chapter}}
            \titleformat{\chapter}[display]
            {\normalfont\fontsize{11pt}{12pt}\selectfont}{\thechapter}{0pt}{}
            %%{\normalfont\fontsize{11pt}{12pt}\selectfont}{\chaptertitlename\space \thechapter}{11pt}{}
            \renewcommand\thesection{\arabic{section}}
            \titleformat{\section}
            {\normalfont\fontsize{11pt}{12pt}\selectfont}{\thesection}{1em}{}
            \titleformat{\subsection}
            {\normalfont\fontsize{11pt}{12pt}\selectfont\itshape}{}{1em}{}
            \titlespacing{\chapter}{0pt}{0pt}{3cm}

            \usepackage{titletoc}
            \titlecontents{chapter}
            [1.5em] % ie, 1.5em (chapter) + 2.3em
            {}
            {\contentslabel{2.3em}}
            {\hspace*{-2.3em}}
            {}
            %{\titlerule*[1pc]{.}\contentspage}

            \begin{document}
            \tableofcontents

            \chapter{Chapter 1 title}
            Some text some text some text some text some text

            \section{Section a title}
            Some text some text some text some text some text

            \section{Section b title}
            Some text some text some text some text some text

            \chapter{Chapter 2 title}
            Some text some text some text some text some text

            \section{Section c title}
            Some text some text some text some text some text

            \section{Section d title}
            Some text some text some text some text some text

            \chapter{Chapter 3 title}
            Some text some text some text some text some text

            \section{Section e title}
            Some text some text some text some text some text

            \section{Section f title}
            Some text some text some text some text some text
            \end{document}`
            Le due cose che nell’indice non funzionano sono:
            1) Come far sì che il numero della pagina non erediti il \fontnotesize del titolo, ma sia
            di normali dimensioni, cioè come il testo? A meno di non eliminare il numero di pagina
            del capitolo, come attualmente ho fatto…

            Basta aggiungere un comando di ridimensionamento prima di \contentspage:
            `\titlecontents{chapter}
            [1.5em] % ie, 1.5em (chapter) + 2.3em
            {}
            {\contentslabel{2.3em}}
            {\hspace*{-2.3em}}
            {\titlerule*[1pc]{.}\normalsize\contentspage}`
            In questo codice particolare non serve a nulla, visto che prima
            non c’è alcun comando di ridimensionamento, ma presumo
            che nel tuo codice ci sia.

            samiel” post=93125
            2) Infine: come allineare i numeri (romani) dei capitoli a destra, e non come sono attualmente,
            e cioè a sinistra?

            Molto semplice:
            `\usepackage[rightlabels]{titletoc}`
            C’è scritto nella doc di titlesec/titletoc

            Ciao
            Ivan

          • #93487
            samiel
            Partecipante
              Up
              0
              Down
              ::


              Ottimo, grazie!
              Funziona tutto tranne un dettaglio di cui mi sono accorto adesso
              La ruga di codice che sovrintende alla linea di puntini che collega
              il titolo al numero di pagina è definita (codice del manuale di titlesec/titletoc)
              `{\titlerule*[1.5em]{.}\contentspage}`
              poiché non ho modificato nulla nelle impostazioni di \section, questi puntini
              sono diversi, molto più radi per i capitoli. Dove trovo lo standard
              della classe book per ripristinarlo? Non basta modificare il dato relativo a pc
              perché cambia anche l’allineamento… In alternativa:
              `{\hfill\contentspage}`
              Ci sono alternative su cui giocare, adesso il problema è riuscire
              a mettere a sinistra i numeri di pagina, e il codice di Pignalberi va fuso
              col resto, ma non so come procedere 🙁

            • #93488
              Up
              0
              Down
              ::

              samiel” post=93136Ottimo, grazie!
              Funziona tutto tranne un dettaglio di cui mi sono accorto adesso
              La ruga di codice che sovrintende alla linea di puntini che collega
              il titolo al numero di pagina è definita (codice del manuale di titlesec/titletoc)
              `{\titlerule*[1.5em]{.}\contentspage}`
              poiché non ho modificato nulla nelle impostazioni di \section, questi puntini
              sono diversi, molto più radi per i capitoli. Dove trovo lo standard
              della classe book per ripristinarlo? Non basta modificare il dato relativo a pc
              perché cambia anche l’allineamento… In alternativa:
              `{\hfill\contentspage}`
              Ci sono alternative su cui giocare, adesso il problema è riuscire
              a mettere a sinistra i numeri di pagina, e il codice di Pignalberi va fuso
              col resto, ma non so come procedere 🙁

              Con suftesi ci sarebbe l’opzione` tocstyle=leftpage`
              😉

              Ciao
              Ivan

            • #93489
              samiel
              Partecipante
                Up
                0
                Down
                ::


                Ho trasportato tutto anche su Suftesi (con xelatex per non dover riscrivere
                tutto il greco e l’ebraico). Ho qualche problemino, ma apro un tread apposito
                appena rivista meglio la documentazione.

                Nel frattempo, spero in qualche anima buona per indicazioni
                sulle malefatte de mio codice postato sopra…

                m

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

            Go to top