0

I'm formating my thesis. When writing drafts I used documentclass article and now I'm migrating to a template which uses documentclass report. I don't like to manualy change \section to \chapter and \subsection to \section and also a couter for theorems from section to counter. Is there an abstraction layer in LaTeX telling me what the toplevel sectioning environment is?

Also in article, \refname is used for bibliography name but \bibname is used in report. Bibliography is added to the table of contents in report but not in article.

Is there a way to unify the text of individual chapters and bibliography so it works consistently with both article and report?

user87690
  • 1,009
  • 1
  • 1
    what features of report are you looking for, \chapter is by far the major difference, so if you don't want to change to \chapter it is probably simpler just to use article and then add any extra features that you need. – David Carlisle Jul 07 '14 at 12:58
  • @mvkorpel: I added a comment to the refered question. There is an issue with \thebibliography. – user87690 Jul 07 '14 at 13:02
  • @DavidCarlisle I'm not sure what features I'm looking for. I don't know which internal parameters are different and which matter for me. The point is I want universal core text files which work with both article and report. Of course I can define helper macros. I'm asking if this can be done automatically because e.g. \thebibliography uses \chapter in report and \section in article, so how does it know? – user87690 Jul 07 '14 at 13:05
  • @user87690 it does not "know" it is just defined separately in article.cls and report.cls. The design of report and article is exactly intended so that sections can be shared but that they are shared as sections in an article but then sections come below chapter in report precisely so that multiple article fragments can be included. If you want \section to be the top level sectioning you want, almost by definition, article not report. – David Carlisle Jul 07 '14 at 13:34
  • Are there any news here? Right now, the question should be answered by the linked question making this here a duplicate. Can you clarify the Q or give a self-answer by now? – Johannes_B Feb 15 '15 at 19:43
  • @Johannes_B: At the end I have defined my own macros \Chapter, \Section, etc and they are defined accordingly depending on whether article or report is used. It is still suboptimal though. Another thing that would be best handled by a separate preprocessor. – user87690 Feb 21 '15 at 14:12
  • But what exactly is your advantage of using one over the other? The real deal is, thinking first what kind of document you are writing, the only real difference between articles and bigger works, they don't have the chapter-level. – Johannes_B Feb 21 '15 at 20:19
  • @Johannes_B: The content of the document can be independent of the used template. Im my case, I was writing a document as article and then I found out I need to use report. I just think it should be easy to switch between those two. I just want to express the structure of the document in relative rather than absolute way. – user87690 Feb 21 '15 at 20:37
  • From the Q and the comments i read, that you were forced to use a template. Feel free to ask in chat what templates mean to me. The thing is, you are writing on a kind of document. There is a difference in writing a book, or a letter, or an article. Imagine working in your garden, just want to dig up a small hole. What do you prefer, a shovel/spade or some 150 tons heavy earthmover? – Johannes_B Feb 21 '15 at 20:42
  • What do i want to say? Even if the content can be whatever you like, the type of document you are writing is somewhat fixed. LaTeX provides different classes for those special needs (basically article, report, book, letter). – Johannes_B Feb 21 '15 at 20:44
  • But the types of documents are not strictly defined and their usage may easily overlap. I think one may need to switch the class sometimes. – user87690 Feb 21 '15 at 21:24
  • 1
    have a look at package coseoul. – Johannes_B Feb 22 '15 at 13:02
  • @Johannes_B: That looks interesting, thank you. – user87690 Feb 24 '15 at 10:06

2 Answers2

1

From the comments, consider using the coseoul package. This provides commands for headings of the form \levelstay, \leveldown and \levelup and a package option initlevel for the initial level, e.g. chapter or section.

Andrew Swann
  • 95,762
1

here is a solution (you need to work as it is article i.e. don't use \chapter command)

Edit: Sorry I did not see Gonzalo Medina's answer to this Macro for promoting sections to chapters

\documentclass{article}
%\documentclass{report}
\ifx\chapter\undefined 
\else 
\let\subsubsection\subsection
\let\subsection\section
\let\section\chapter
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\fi

\begin{document}
\tableofcontents
\section{Foo section}
\subsection{Foo subsection}
\subsection{Bar subsection}
\subsubsection{Foo subsubsection}
\section{Bar section}
\subsection{Bar subsection}
\subsection{Baz subsection}
\subsubsection{Bar subsubsection}
\end{document}
touhami
  • 19,520
  • Thank you for the answer. Since the question was asked I have improved my approach to this problem. Currently, I use a relative section environment that can be nested and all levels use the same command. It's up to my macros to invoke \section, \subsection etc. where appropriate. – user87690 Sep 03 '15 at 11:07