1

I have the following code:

\documentclass[a4paper,12pt]{article} \renewcommand{\proofname}{\textbf{Beweis}} \newtheorem{Satz}{Satz}[section] \newtheorem{code}[Satz]{MATLAB-Code} \begin{document} \section*{Anhang} \renewcommand\thesection{\hspace{-1em}} \sectionmark{Anhang} \addcontentsline{toc}{section}{Anhang} \begin{code} ... \end{code} \end{document} 

The problem is that the number of the code overlaps with the word MATLAB-Code in the appendix (Anhang). I guess it has something to do that there is no section number for the appendix. How can I fix that? If I write

\newtheorem{code}{MATLAB-Code} 

then the number of the newtheorem and the word MATLAB-Code don't overlap, but then the codes get numberes from 1 on instead of using the section number. Thanks a lot!!!

10
  • Can provide a working example illustrating the problem. Removing [Satz] from the above code makes it compilable, but also does not show any problem with overlapping numbers. Commented Nov 27, 2013 at 13:44
  • I did exact the same for \newtheorem{Bem}[Satz]{Bemerkung} and there it works. My guess is that MATLAB-Code is too long. Commented Nov 27, 2013 at 13:47
  • There is something you are not telling us. This includes something in the document sets up the count Satz, and possibly theorem related packages you are loading... Commented Nov 27, 2013 at 13:50
  • you are right, if i delete [Satz] it's working. That's exact how I wanted it, thanks. Commented Nov 27, 2013 at 13:52
  • But then the number of MATLAB-code starts with one, but I want that the number is the chapter number.1, chapter number.2 and so on. Commented Nov 27, 2013 at 13:59

1 Answer 1

1

You ask how remove section numbers of theorem like items in the appendix. Redefining \thesection to \hspace{-1em} causes you many problems as you found out.

Instead to remove section numbering of these elements in the appendix use the chngcntr packages's function \counterwithout:

Sample output

\documentclass[a4paper,12pt]{article} \usepackage{chngcntr} \newtheorem{Satz}{Satz}[section] \newtheorem{code}[Satz]{MATLAB-Code} \begin{document} \section{A section} \begin{Satz} Theorem text. \end{Satz} \section*{Anhang} \counterwithout{Satz}{section} \sectionmark{Anhang} \addcontentsline{toc}{section}{Anhang} \begin{code} ... \end{code} \end{document} 
2
  • Thanks for your answer. If I use this code it still shows the section number of the Apeendix in the Header. How can I get rid of that? Commented Nov 29, 2013 at 11:22
  • The above code produces no header, so you will have to tell us how you make your headers. That is probably best done as a separate question. But have a look around this site for related questions. Commented Nov 29, 2013 at 12:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.