Remove indentation in table of contents












1















I want remove the space in my table of contents of section, subsection and subsubsection.



This is my code:



documentclass{book}
usepackage[utf8]{inputenc}
usepackage{imakeidx}
makeindex[columns=3, title=Alphabetical Index, intoc]

begin{document}

tableofcontents
chapter{chapter}
section{Introduction}
In this example several keywordsindex{keywords} will be
used which are important and deserve to appear in the
Indexindex{Index}.
subsection{subsection}
Terms like generateindex{generate} and someindex{others}
will also show up. Terms in the index can also be
nested index{Index!nested}

clearpage

section{Second section}
This second sectionindex{section} may include some special
word, and expand the ones already usedindex{keywords!used}.

printindex
end{document}


enter image description here










share|improve this question





























    1















    I want remove the space in my table of contents of section, subsection and subsubsection.



    This is my code:



    documentclass{book}
    usepackage[utf8]{inputenc}
    usepackage{imakeidx}
    makeindex[columns=3, title=Alphabetical Index, intoc]

    begin{document}

    tableofcontents
    chapter{chapter}
    section{Introduction}
    In this example several keywordsindex{keywords} will be
    used which are important and deserve to appear in the
    Indexindex{Index}.
    subsection{subsection}
    Terms like generateindex{generate} and someindex{others}
    will also show up. Terms in the index can also be
    nested index{Index!nested}

    clearpage

    section{Second section}
    This second sectionindex{section} may include some special
    word, and expand the ones already usedindex{keywords!used}.

    printindex
    end{document}


    enter image description here










    share|improve this question



























      1












      1








      1








      I want remove the space in my table of contents of section, subsection and subsubsection.



      This is my code:



      documentclass{book}
      usepackage[utf8]{inputenc}
      usepackage{imakeidx}
      makeindex[columns=3, title=Alphabetical Index, intoc]

      begin{document}

      tableofcontents
      chapter{chapter}
      section{Introduction}
      In this example several keywordsindex{keywords} will be
      used which are important and deserve to appear in the
      Indexindex{Index}.
      subsection{subsection}
      Terms like generateindex{generate} and someindex{others}
      will also show up. Terms in the index can also be
      nested index{Index!nested}

      clearpage

      section{Second section}
      This second sectionindex{section} may include some special
      word, and expand the ones already usedindex{keywords!used}.

      printindex
      end{document}


      enter image description here










      share|improve this question
















      I want remove the space in my table of contents of section, subsection and subsubsection.



      This is my code:



      documentclass{book}
      usepackage[utf8]{inputenc}
      usepackage{imakeidx}
      makeindex[columns=3, title=Alphabetical Index, intoc]

      begin{document}

      tableofcontents
      chapter{chapter}
      section{Introduction}
      In this example several keywordsindex{keywords} will be
      used which are important and deserve to appear in the
      Indexindex{Index}.
      subsection{subsection}
      Terms like generateindex{generate} and someindex{others}
      will also show up. Terms in the index can also be
      nested index{Index!nested}

      clearpage

      section{Second section}
      This second sectionindex{section} may include some special
      word, and expand the ones already usedindex{keywords!used}.

      printindex
      end{document}


      enter image description here







      table-of-contents indentation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 0:54









      Werner

      439k669651659




      439k669651659










      asked Nov 22 '18 at 0:11









      x-rwx-rw

      37217




      37217






















          2 Answers
          2






          active

          oldest

          votes


















          3














          Using tocloft, these lengths are managed by cftXindent where X includes chap (for chapter), sec (for section) and subsec (for subsection):



          enter image description here



          documentclass{book}

          usepackage{lipsum}
          usepackage{tocloft}

          setlength{cftsecindent}{0pt}% Remove indent for section
          setlength{cftsubsecindent}{0pt}% Remove indent for subsection
          % setlength{cftsubsubsecindent}{0pt}% Remove indent for subsubsection

          begin{document}

          tableofcontents

          chapter{A chapter}
          section{First section}lipsum[1-5]
          subsection{A subsection}lipsum[6-10]
          section{Second section}lipsum[11-15]

          end{document}





          share|improve this answer































            1














            A solution with titletoc:



             documentclass{book}
            usepackage[showframe]{geometry}
            usepackage[utf8]{inputenc}
            usepackage{imakeidx}
            makeindex[columns=3, title=Alphabetical Index, intoc]
            usepackage{titletoc}
            contentsmargin{0.2pt}
            titlecontents{section}
            [2.5em]
            {vspace*{baselineskip}mdseries}
            {contentslabel[thecontentslabel]{2.5em}}
            {}
            {hfillthecontentspage}
            titlecontents{subsection}
            [2.5em]
            {vspace*{baselineskip}mdseries}
            {contentslabel[thecontentslabel]{2.5em}}
            {}
            {hfillthecontentspage}


            begin{document}

            tableofcontents
            chapter{chapter}
            section{Introduction}
            In this example several keywordsindex{keywords} will be
            used which are important and deserve to appear in the
            Indexindex{Index}.
            subsection{subsection}
            Terms like generateindex{generate} and someindex{others}
            will also show up. Terms in the index can also be
            nested index{Index!nested}

            clearpage

            section{Second section}
            This second sectionindex{section} may include some special
            word, and expand the ones already usedindex{keywords!used}.

            printindex

            end{document}


            enter image description here






            share|improve this answer























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "85"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461216%2fremove-indentation-in-table-of-contents%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              Using tocloft, these lengths are managed by cftXindent where X includes chap (for chapter), sec (for section) and subsec (for subsection):



              enter image description here



              documentclass{book}

              usepackage{lipsum}
              usepackage{tocloft}

              setlength{cftsecindent}{0pt}% Remove indent for section
              setlength{cftsubsecindent}{0pt}% Remove indent for subsection
              % setlength{cftsubsubsecindent}{0pt}% Remove indent for subsubsection

              begin{document}

              tableofcontents

              chapter{A chapter}
              section{First section}lipsum[1-5]
              subsection{A subsection}lipsum[6-10]
              section{Second section}lipsum[11-15]

              end{document}





              share|improve this answer




























                3














                Using tocloft, these lengths are managed by cftXindent where X includes chap (for chapter), sec (for section) and subsec (for subsection):



                enter image description here



                documentclass{book}

                usepackage{lipsum}
                usepackage{tocloft}

                setlength{cftsecindent}{0pt}% Remove indent for section
                setlength{cftsubsecindent}{0pt}% Remove indent for subsection
                % setlength{cftsubsubsecindent}{0pt}% Remove indent for subsubsection

                begin{document}

                tableofcontents

                chapter{A chapter}
                section{First section}lipsum[1-5]
                subsection{A subsection}lipsum[6-10]
                section{Second section}lipsum[11-15]

                end{document}





                share|improve this answer


























                  3












                  3








                  3







                  Using tocloft, these lengths are managed by cftXindent where X includes chap (for chapter), sec (for section) and subsec (for subsection):



                  enter image description here



                  documentclass{book}

                  usepackage{lipsum}
                  usepackage{tocloft}

                  setlength{cftsecindent}{0pt}% Remove indent for section
                  setlength{cftsubsecindent}{0pt}% Remove indent for subsection
                  % setlength{cftsubsubsecindent}{0pt}% Remove indent for subsubsection

                  begin{document}

                  tableofcontents

                  chapter{A chapter}
                  section{First section}lipsum[1-5]
                  subsection{A subsection}lipsum[6-10]
                  section{Second section}lipsum[11-15]

                  end{document}





                  share|improve this answer













                  Using tocloft, these lengths are managed by cftXindent where X includes chap (for chapter), sec (for section) and subsec (for subsection):



                  enter image description here



                  documentclass{book}

                  usepackage{lipsum}
                  usepackage{tocloft}

                  setlength{cftsecindent}{0pt}% Remove indent for section
                  setlength{cftsubsecindent}{0pt}% Remove indent for subsection
                  % setlength{cftsubsubsecindent}{0pt}% Remove indent for subsubsection

                  begin{document}

                  tableofcontents

                  chapter{A chapter}
                  section{First section}lipsum[1-5]
                  subsection{A subsection}lipsum[6-10]
                  section{Second section}lipsum[11-15]

                  end{document}






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 22 '18 at 0:53









                  WernerWerner

                  439k669651659




                  439k669651659























                      1














                      A solution with titletoc:



                       documentclass{book}
                      usepackage[showframe]{geometry}
                      usepackage[utf8]{inputenc}
                      usepackage{imakeidx}
                      makeindex[columns=3, title=Alphabetical Index, intoc]
                      usepackage{titletoc}
                      contentsmargin{0.2pt}
                      titlecontents{section}
                      [2.5em]
                      {vspace*{baselineskip}mdseries}
                      {contentslabel[thecontentslabel]{2.5em}}
                      {}
                      {hfillthecontentspage}
                      titlecontents{subsection}
                      [2.5em]
                      {vspace*{baselineskip}mdseries}
                      {contentslabel[thecontentslabel]{2.5em}}
                      {}
                      {hfillthecontentspage}


                      begin{document}

                      tableofcontents
                      chapter{chapter}
                      section{Introduction}
                      In this example several keywordsindex{keywords} will be
                      used which are important and deserve to appear in the
                      Indexindex{Index}.
                      subsection{subsection}
                      Terms like generateindex{generate} and someindex{others}
                      will also show up. Terms in the index can also be
                      nested index{Index!nested}

                      clearpage

                      section{Second section}
                      This second sectionindex{section} may include some special
                      word, and expand the ones already usedindex{keywords!used}.

                      printindex

                      end{document}


                      enter image description here






                      share|improve this answer




























                        1














                        A solution with titletoc:



                         documentclass{book}
                        usepackage[showframe]{geometry}
                        usepackage[utf8]{inputenc}
                        usepackage{imakeidx}
                        makeindex[columns=3, title=Alphabetical Index, intoc]
                        usepackage{titletoc}
                        contentsmargin{0.2pt}
                        titlecontents{section}
                        [2.5em]
                        {vspace*{baselineskip}mdseries}
                        {contentslabel[thecontentslabel]{2.5em}}
                        {}
                        {hfillthecontentspage}
                        titlecontents{subsection}
                        [2.5em]
                        {vspace*{baselineskip}mdseries}
                        {contentslabel[thecontentslabel]{2.5em}}
                        {}
                        {hfillthecontentspage}


                        begin{document}

                        tableofcontents
                        chapter{chapter}
                        section{Introduction}
                        In this example several keywordsindex{keywords} will be
                        used which are important and deserve to appear in the
                        Indexindex{Index}.
                        subsection{subsection}
                        Terms like generateindex{generate} and someindex{others}
                        will also show up. Terms in the index can also be
                        nested index{Index!nested}

                        clearpage

                        section{Second section}
                        This second sectionindex{section} may include some special
                        word, and expand the ones already usedindex{keywords!used}.

                        printindex

                        end{document}


                        enter image description here






                        share|improve this answer


























                          1












                          1








                          1







                          A solution with titletoc:



                           documentclass{book}
                          usepackage[showframe]{geometry}
                          usepackage[utf8]{inputenc}
                          usepackage{imakeidx}
                          makeindex[columns=3, title=Alphabetical Index, intoc]
                          usepackage{titletoc}
                          contentsmargin{0.2pt}
                          titlecontents{section}
                          [2.5em]
                          {vspace*{baselineskip}mdseries}
                          {contentslabel[thecontentslabel]{2.5em}}
                          {}
                          {hfillthecontentspage}
                          titlecontents{subsection}
                          [2.5em]
                          {vspace*{baselineskip}mdseries}
                          {contentslabel[thecontentslabel]{2.5em}}
                          {}
                          {hfillthecontentspage}


                          begin{document}

                          tableofcontents
                          chapter{chapter}
                          section{Introduction}
                          In this example several keywordsindex{keywords} will be
                          used which are important and deserve to appear in the
                          Indexindex{Index}.
                          subsection{subsection}
                          Terms like generateindex{generate} and someindex{others}
                          will also show up. Terms in the index can also be
                          nested index{Index!nested}

                          clearpage

                          section{Second section}
                          This second sectionindex{section} may include some special
                          word, and expand the ones already usedindex{keywords!used}.

                          printindex

                          end{document}


                          enter image description here






                          share|improve this answer













                          A solution with titletoc:



                           documentclass{book}
                          usepackage[showframe]{geometry}
                          usepackage[utf8]{inputenc}
                          usepackage{imakeidx}
                          makeindex[columns=3, title=Alphabetical Index, intoc]
                          usepackage{titletoc}
                          contentsmargin{0.2pt}
                          titlecontents{section}
                          [2.5em]
                          {vspace*{baselineskip}mdseries}
                          {contentslabel[thecontentslabel]{2.5em}}
                          {}
                          {hfillthecontentspage}
                          titlecontents{subsection}
                          [2.5em]
                          {vspace*{baselineskip}mdseries}
                          {contentslabel[thecontentslabel]{2.5em}}
                          {}
                          {hfillthecontentspage}


                          begin{document}

                          tableofcontents
                          chapter{chapter}
                          section{Introduction}
                          In this example several keywordsindex{keywords} will be
                          used which are important and deserve to appear in the
                          Indexindex{Index}.
                          subsection{subsection}
                          Terms like generateindex{generate} and someindex{others}
                          will also show up. Terms in the index can also be
                          nested index{Index!nested}

                          clearpage

                          section{Second section}
                          This second sectionindex{section} may include some special
                          word, and expand the ones already usedindex{keywords!used}.

                          printindex

                          end{document}


                          enter image description here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 22 '18 at 0:51









                          BernardBernard

                          167k769194




                          167k769194






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461216%2fremove-indentation-in-table-of-contents%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              404 Error Contact Form 7 ajax form submitting

                              How to know if a Active Directory user can login interactively

                              TypeError: fit_transform() missing 1 required positional argument: 'X'