Accessing chapter's name in Koma-Script Announcing the arrival of Valued Associate #679: Cesar...

Can Pao de Queijo, and similar foods, be kosher for Passover?

Why did the IBM 650 use bi-quinary?

How discoverable are IPv6 addresses and AAAA names by potential attackers?

What is this single-engine low-wing propeller plane?

Can inflation occur in a positive-sum game currency system such as the Stack Exchange reputation system?

Should I call the interviewer directly, if HR aren't responding?

Letter Boxed validator

What makes black pepper strong or mild?

How to draw this diagram using TikZ package?

Do I really need recursive chmod to restrict access to a folder?

G-Code for resetting to 100% speed

Check which numbers satisfy the condition [A*B*C = A! + B! + C!]

How to recreate this effect in Photoshop?

How do I stop a creek from eroding my steep embankment?

Is there a "higher Segal conjecture"?

What's the purpose of writing one's academic bio in 3rd person?

Why is black pepper both grey and black?

Should gear shift center itself while in neutral?

Output the ŋarâþ crîþ alphabet song without using (m)any letters

How do I mention the quality of my school without bragging

When to stop saving and start investing?

The logistics of corpse disposal

How much radiation do nuclear physics experiments expose researchers to nowadays?

Is there a documented rationale why the House Ways and Means chairman can demand tax info?



Accessing chapter's name in Koma-Script



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to get the current chapter* name, section* name, subsection* name, etc?Separate column in table of contents (in Memoir)Different labels for subsection titles and referencesConversion of Sectioning Numbers in ConTeXtUsing the long form of a section title in the TOCincluding book name and chapter name above section name in memoirCustomizing chapter and section style (scrbook)Insert the number and name of the section in the header, (including on a chapter's opening page)Default dimensions sections name in book classFormat fonts for TOC/LOF/LOT with tocloftHeader with Section short title and Chapter short title using KOMA-script












0















I looked up for a solution to access the name of current sections (chapters, sections, etc.) from macros (including starred variations of the section command). The set of macros proposed here works like a charm in the base class book.



documentclass{book}

usepackage{etoolbox}
% Patch the sectioning commands to provide a hook to be used later
preto{chapter}{defleveltitle{chaptertitle}}
preto{section}{defleveltitle{sectiontitle}}
preto{subsection}{defleveltitle{subsectiontitle}}
preto{subsubsection}{defleveltitle{subsubsectiontitle}}

makeatletter
pretocmd{@sect}
{expandaftergdefleveltitle{#8}}
{}{}
pretocmd{@ssect}
{expandaftergdefleveltitle{#5}}
{}{}
pretocmd{@chapter}
{expandaftergdefleveltitle{#2}}
{}{}
pretocmd{@schapter}
{expandaftergdefleveltitle{#1}}
{}{}
makeatother

newcommandtest{%
noindent
The chapter title is chaptertitle\
The section title is sectiontitle\
The subsection title is subsectiontitle\
The subsubsection title is subsubsectiontitle
}

begin{document}
chapter{First chapter}
section{First section}
subsection{First subsection}
subsubsection{First subsubsection}

test

chapter*{Second chapter}
section*{Second section}
subsection*{Second subsection}
subsubsection*{Second subsubsection}

test
end{document}


book_example



However I need to implement my macros in Koma-Script, with scrbook and here things start to get unexpected. With the same code but with class scrbook I get the following:



enter image description here



The chapter name is not rendered. I looked up the code of scrbook and the title is indeed #2. Is there something wrong with the macros and how to fix this issue?



For my needs, it is not possible to use nameref, I need a hard-coded solution. Thanks for you help.



Bonus: Is it possible to choose between long titles and short titles (the ones defined with section[short]{long}? Thanks again.









share



























    0















    I looked up for a solution to access the name of current sections (chapters, sections, etc.) from macros (including starred variations of the section command). The set of macros proposed here works like a charm in the base class book.



    documentclass{book}

    usepackage{etoolbox}
    % Patch the sectioning commands to provide a hook to be used later
    preto{chapter}{defleveltitle{chaptertitle}}
    preto{section}{defleveltitle{sectiontitle}}
    preto{subsection}{defleveltitle{subsectiontitle}}
    preto{subsubsection}{defleveltitle{subsubsectiontitle}}

    makeatletter
    pretocmd{@sect}
    {expandaftergdefleveltitle{#8}}
    {}{}
    pretocmd{@ssect}
    {expandaftergdefleveltitle{#5}}
    {}{}
    pretocmd{@chapter}
    {expandaftergdefleveltitle{#2}}
    {}{}
    pretocmd{@schapter}
    {expandaftergdefleveltitle{#1}}
    {}{}
    makeatother

    newcommandtest{%
    noindent
    The chapter title is chaptertitle\
    The section title is sectiontitle\
    The subsection title is subsectiontitle\
    The subsubsection title is subsubsectiontitle
    }

    begin{document}
    chapter{First chapter}
    section{First section}
    subsection{First subsection}
    subsubsection{First subsubsection}

    test

    chapter*{Second chapter}
    section*{Second section}
    subsection*{Second subsection}
    subsubsection*{Second subsubsection}

    test
    end{document}


    book_example



    However I need to implement my macros in Koma-Script, with scrbook and here things start to get unexpected. With the same code but with class scrbook I get the following:



    enter image description here



    The chapter name is not rendered. I looked up the code of scrbook and the title is indeed #2. Is there something wrong with the macros and how to fix this issue?



    For my needs, it is not possible to use nameref, I need a hard-coded solution. Thanks for you help.



    Bonus: Is it possible to choose between long titles and short titles (the ones defined with section[short]{long}? Thanks again.









    share

























      0












      0








      0








      I looked up for a solution to access the name of current sections (chapters, sections, etc.) from macros (including starred variations of the section command). The set of macros proposed here works like a charm in the base class book.



      documentclass{book}

      usepackage{etoolbox}
      % Patch the sectioning commands to provide a hook to be used later
      preto{chapter}{defleveltitle{chaptertitle}}
      preto{section}{defleveltitle{sectiontitle}}
      preto{subsection}{defleveltitle{subsectiontitle}}
      preto{subsubsection}{defleveltitle{subsubsectiontitle}}

      makeatletter
      pretocmd{@sect}
      {expandaftergdefleveltitle{#8}}
      {}{}
      pretocmd{@ssect}
      {expandaftergdefleveltitle{#5}}
      {}{}
      pretocmd{@chapter}
      {expandaftergdefleveltitle{#2}}
      {}{}
      pretocmd{@schapter}
      {expandaftergdefleveltitle{#1}}
      {}{}
      makeatother

      newcommandtest{%
      noindent
      The chapter title is chaptertitle\
      The section title is sectiontitle\
      The subsection title is subsectiontitle\
      The subsubsection title is subsubsectiontitle
      }

      begin{document}
      chapter{First chapter}
      section{First section}
      subsection{First subsection}
      subsubsection{First subsubsection}

      test

      chapter*{Second chapter}
      section*{Second section}
      subsection*{Second subsection}
      subsubsection*{Second subsubsection}

      test
      end{document}


      book_example



      However I need to implement my macros in Koma-Script, with scrbook and here things start to get unexpected. With the same code but with class scrbook I get the following:



      enter image description here



      The chapter name is not rendered. I looked up the code of scrbook and the title is indeed #2. Is there something wrong with the macros and how to fix this issue?



      For my needs, it is not possible to use nameref, I need a hard-coded solution. Thanks for you help.



      Bonus: Is it possible to choose between long titles and short titles (the ones defined with section[short]{long}? Thanks again.









      share














      I looked up for a solution to access the name of current sections (chapters, sections, etc.) from macros (including starred variations of the section command). The set of macros proposed here works like a charm in the base class book.



      documentclass{book}

      usepackage{etoolbox}
      % Patch the sectioning commands to provide a hook to be used later
      preto{chapter}{defleveltitle{chaptertitle}}
      preto{section}{defleveltitle{sectiontitle}}
      preto{subsection}{defleveltitle{subsectiontitle}}
      preto{subsubsection}{defleveltitle{subsubsectiontitle}}

      makeatletter
      pretocmd{@sect}
      {expandaftergdefleveltitle{#8}}
      {}{}
      pretocmd{@ssect}
      {expandaftergdefleveltitle{#5}}
      {}{}
      pretocmd{@chapter}
      {expandaftergdefleveltitle{#2}}
      {}{}
      pretocmd{@schapter}
      {expandaftergdefleveltitle{#1}}
      {}{}
      makeatother

      newcommandtest{%
      noindent
      The chapter title is chaptertitle\
      The section title is sectiontitle\
      The subsection title is subsectiontitle\
      The subsubsection title is subsubsectiontitle
      }

      begin{document}
      chapter{First chapter}
      section{First section}
      subsection{First subsection}
      subsubsection{First subsubsection}

      test

      chapter*{Second chapter}
      section*{Second section}
      subsection*{Second subsection}
      subsubsection*{Second subsubsection}

      test
      end{document}


      book_example



      However I need to implement my macros in Koma-Script, with scrbook and here things start to get unexpected. With the same code but with class scrbook I get the following:



      enter image description here



      The chapter name is not rendered. I looked up the code of scrbook and the title is indeed #2. Is there something wrong with the macros and how to fix this issue?



      For my needs, it is not possible to use nameref, I need a hard-coded solution. Thanks for you help.



      Bonus: Is it possible to choose between long titles and short titles (the ones defined with section[short]{long}? Thanks again.







      sectioning cross-referencing koma-script





      share












      share










      share



      share










      asked 7 mins ago









      8173781737

      284




      284






















          0






          active

          oldest

          votes












          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%2f485065%2faccessing-chapters-name-in-koma-script%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f485065%2faccessing-chapters-name-in-koma-script%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

          El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

          Castillo d'Acher Características Menú de navegación

          Connecting two nodes from the same mother node horizontallyTikZ: What EXACTLY does the the |- notation for...