LaTeX forum ⇒ General ⇒ Combination of \addcontentsline and \subimport doesn't work?

LaTeX specific issues not fitting into one of the other forums of this category.
Borstenjäger
Posts: 2
Joined: Mon Nov 09, 2015 1:12 pm

Combination of \addcontentsline and \subimport doesn't work?

Hello,

in my document I want headings and table of content without numbering. The way I'm trying do make it is

`\subsection*{\subimport{../texts/}{heading01_\VarLanguage.tex}}\addcontentsline{toc}{subsection}{\subimport{../texts/}{heading01_\VarLanguage.tex}}`

where "VarLanguage" contains a two-letter code for the language like en for english or fr for french. The files heading01_en.tex and heading01_fr.tex contain the heading in english and french.

The first line works perfectly and makes the heading in the document. The second line should bring thesame heading into the toc but instead it causes the following error:

`TeX capacity exceeded, sorry [parameter stack size=10000]. ...texts/}{heading01_\VarLanguage.tex}}`

Unfortunately I could not find a solution with google. Can anyone help me?

By the way, the document class is article.

Thank you!
Mark

Tags:

Johannes_B
Site Moderator
Posts: 4163
Joined: Thu Nov 01, 2012 4:08 pm
If you don't want sections to be numbered, use `\setcounter{secnumdepth}{-5}`.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Borstenjäger
Posts: 2
Joined: Mon Nov 09, 2015 1:12 pm
Thank you Johannes for your reply. Although the setcounter command works perfectly, unfortunately it doesn't solve my problem. Meanwhile i found out that I get the error also when I combine \subimport with any command that causes an entry in the toc.

Well, for me I found a workaround: Since I modify the .tex files with a third party software before compiling them I modify the headline with this software. Within Latex the text in the \subsection command is then a static text.

I hope this helps others with thesame problem. However, if you have a better solution please post it here.

Thank you!
Mark

Johannes_B
Site Moderator
Posts: 4163
Joined: Thu Nov 01, 2012 4:08 pm
Can you post a small, yet compilable minimal code example? Right now, it is hard for me to even imagine how the real error looks like and what triggers it. nce i see the symptoms, we can work on a fix.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.