4

I need to use the combine package so that each included LaTeX document shows up with its its own toc in the main document, with its own heading. (similar to how papers appear in journal books, each as a separate document within one large document)

The problem is that it seems not to work with hyperref, and I have to use hyperref. I googled around, and can't find any help on this. This seems to be a known issue. Hence the reason to ask, may be someone knows something.

Any one knows of a work around? It does not matter if I add \usepackage{hyperref} in the main document, or in the included document. Nothing seems to work for me. I also tried using standalone in the main document. But another problem showed up. So not sure what to do now. The included file does build OK on its own ofcourse but not when combined.

Here is a MWE: main.tex

\documentclass[report]{combine}
%\usepackage{hyperref}
\title{my book}
\author{me}

\begin{document}
\pagestyle{combine}
\maketitle
\tableofcontents

\section{papers}

\begin{papers}
   \import{art1}
\end{papers}

\end{document}

here is art1.tex (in same folder)

\documentclass{article}
\usepackage{hyperref}

\title{my paper 1}
\author{me inside article 1}

\begin{document}
\maketitle
\tableofcontents

\href{someURL}{home}    %problem is here

\end{document}

and now

pdflatex main.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
 restricted \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2011/06/27>
...................
No file art1.aux.
(./art1.toc)
! Undefined control sequence.
l.11 \href
          {someURL}{home}    %problem is here
? 

Update:

I tried the trick shown here. But did not work:

\documentclass[report]{combine}
%\usepackage{hyperref}
\title{my book}
\author{me}

\begin{document}
\pagestyle{combine}
\maketitle
\tableofcontents

\section{papers}

\makeatletter    %see link above. Is this supposed to fix this? it did not for me
\let\@begindocumenthook\relax
\makeatother

\begin{papers}
   \import{art1}
\end{papers}

\end{document}
  • tex.stackexchange.com/questions/76202/… OP there seems to have gotten it working. Does this help? – Sean Allred Oct 29 '13 at 14:46
  • @SeanAllred I read that post, and tried adding \makeatletter \let\@begindocumenthook\relax \makeatother as shown there. NO difference. Same problem. I did not really understand the answer there at all. – Nasser Oct 29 '13 at 14:51
  • The problem is entirely different, but it's a good step forward to work from the answer's working example---at least to see what is actually going wrong here. It might just be that it's only \href that is acting up (unlikely, but possible). – Sean Allred Oct 29 '13 at 15:44
  • 2
    I must be the only person in the world using This package, or using this package but not using hyperref. In both cases, I now feel very special. – Nasser Oct 30 '13 at 1:20
  • 1
    If I use navigator, with its \urllink{...}{...} command, instead of hyperref and its \href{...}{...} command, and load navigator in main.tex as well as in art1.tex, all seems well. – Thérèse Jan 24 '16 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.