2

I am using org-mode to manage both HTML and PDF versions of my notes. When it exports to LaTeX, it uses \section, \subsection etc. But the document class I use have \chapter, \section, \subsection as outlining commands. So I tried to make every \section into a \chapter and every \subsection into a \section. To achieve this, I tried following:

\renewcommand{\subsection}{\section}
\renewcommand{\section}{\chapter}

But here, subsection become section and since sections then become chapter, I am left with only chapters. How can I a achieve this behaviour? My document class is not supported well by org-mode so I am trying to tweak my output manually. That's why I am seeking a primarily LaTeX solution rather than scripting org-mode with Elisp.

  • Maybe try this: \let\oldsection\section\renewcommand{\subsection}{\oldsection}\renewcommand{\section}{\chapter}. – Bernard Jan 1 '17 at 13:58
2

You have to use \let statements, in this order:

\let\subsubsection\subsection
\let\subsection\section
\let\section\chapter

After \let\subsubsection\subsection the former definition of \subsubsection is inaccessible; instead, \subsubsection and \subsection now both point to the definition of \subsection.

After \let\subsection\section, \subsection points to the definition of \section; the former definition of \subsection is still available via \subsubsection because of the previous \let statement.

Finally, after \let\section\chapter, \section points to the definition of \chapter (as \chapter continues to do, but you will not use this command); the former definition of \section is still available via \subsection because of the previous \let statement.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.