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

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

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

Post by Borstenjäger »

Hello,

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

Code: Select all

\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:

Code: Select all

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

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

Post by Johannes_B »

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

Re: Combination of \addcontentsline and \subimport doesn't w

Post by Borstenjäger »

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
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Combination of \addcontentsline and \subimport doesn't w

Post by Johannes_B »

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.
Post Reply