Take the 2-minute tour ×
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.

I am trying to squish several journal papers together (using the combine document class) to provide the filling for my thesis sandwich. The papers make use of the siunitx package but causes an error.

A similar posting is here: Using the "combine" document class with the listings package from which I have adapted the folowing minimal working example:

\documentclass{combine}                  
\usepackage[load=named]{siunitx}
\begin{document}

\begin{papers}
\coltoctitle{Title}
\coltocauthor{Author}
\label{lbl}
\import{test}
\end{papers}

\end{document}

and in test.tex

\documentclass{article}
\begin{document}
 Hello World
\end{document}

and I get the following error:

ERROR: LaTeX error: "kernel/command-already-defined"    
--- TeX said --- !
! Control sequence \c_siunitx_textsf_tl already defined.

Can anyone help?

share|improve this question
2  
If you simply want to have journal papers like they are in your thesis use the pdfpages package. If you want to merge them to build your thesis I would rather do this manually. –  Martin Scharrer Jan 23 '12 at 14:18
    
@Martin: I looked at pdfpages but wouldn't be able to reference equations and figures in the Discussion and Conclusion as easily, or add the papers' TOCs to the main thesis TOC –  myles Jan 23 '12 at 14:21
    
How many papers are we talking here? It seems to me that the manual route is worth it for something as significant as a thesis. In fact, many universities do not allow this (mine did not either). I assume you've checked the guidelines for your school on this though! –  qubyte Jan 23 '12 at 15:38
    
@Mark: Just three papers-in-progress. If you mean 'does my uni allow a thesis in the paper sandwich format' then Yes it does. I am not against manual methods in principal but I would have to maintain the main TOC and any \refs I make in the main document that refer to the papers when the papers develop. –  myles Jan 23 '12 at 15:48
    
I wound up writing papers and thesis in tandem. It's a surprisingly good way of experimenting with structure. I understand where you're coming from though. –  qubyte Jan 23 '12 at 15:54

1 Answer 1

up vote 1 down vote accepted

As you say, this is caused by code at the beginning of the document. At least for the minimal example, simply bypassing this code in the subsidiary document works:

\documentclass{article}
\makeatletter
\@ifclassloaded{combine}
  {\let\@begindocumenthook\@empty}
  {}
\makeatother
\begin{document}
 Hello World
\end{document}

(\@begindocumenthook is where the \AtBeginDocumentCode is stored.)

share|improve this answer
    
Thanks Joseph I was hoping you would chip in! Works great. I should correct what I said above about being able to "reference equations and figures" in sub documents from the main document: it can't be done. –  myles Jan 26 '12 at 1:24
    
I am combining several documents. I need the siunitx package so I used Joseph's suggestion. Unfortunately, this causes other problems with, for example, section numbering (3.65 instead of 4) and the numbering of theorem like environments. Does anyone know of a way to avoid this problem. –  Tom Price Jun 29 '13 at 16:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.