I have a few sections of content I want repeated in multiple chapters. When I include it twice it looks fine in the document but references within that section always go to the section that is included last. This makes sense because the labels are being redefined. Is there anyway to change this behavior or perhaps a better way to add a section to multiple chapters. For example, allowing only references to come from the chapter the section resides in.
Tell me more
×
TeX - LaTeX Stack Exchange is a question and answer site for
users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
|
Define special commands for labels and references to the elements of the common section. Main file
File to be included multiple times
|
Very clever. Didn't work for me at first but doing
\newcommand{\mlabel}[1]{\label{\thechapter_#1}}
\DeclareRobustCommand{\mref}[1]{\ref{\thechapter_#1}}
did the trick. Didn't like something about the @@.
Thanks! – zlalanne Feb 4 at 19:51 |


\labels and\refs? And using\label{<lab>}more than once with the same<lab>is a problem (of course). For this repeated section you could turn off the meaning of\labelwhile still keeping\ref. However, this doesn't make sense in terms of your last comment: "allowing only references to come from the chapter the section resides in." References will come from the first place the section was included. Please clarify. – Werner Feb 4 at 18:47