0

I make long technical (building engineering) documentation.

In those docs, the standard is to explain stuff in the main doc and put a reference to a detailed calculation at the end.

So I would like to know if I can do this...

\section{roofs}

The roof is 5 metres large per 30 metres long and the wind blablabla...

Detail is provided in include X.

\includepdf[pages=-]{extracts/roof.pdf}

\section{walls}

Walls are 20 cm concrete plates.

Calculations are provided as extract Y.

\includepdf[pages=-]{extracts/walls.pdf}

And the extracts will be included in the respective order, and then latex will replace X and Y by the respective numbers (just like it does with labels) by virtue of a command or reference that I will place here.

Edit to forbid confusion on renumbering of includes.

8
  • No, the external documents are made using other softwares (structural or even custom and macro excel sheets)
    – 22decembre
    Commented Jun 11 at 11:19
  • I am not to extract info, I am just to include the whole pdf as an include at the end of the file. (word "extract" was maybe not the best choice here, acknowledged)
    – 22decembre
    Commented Jun 11 at 11:32
  • Any page numbers of such printed on the original will show up on the copy. You could add information manually ond ovelap the image. Commented Jun 11 at 11:38
  • Ok, now I'm confused. Which X should latex replace? The The roof is X metres large or the Detail is provided in extract X.? Commented Jun 11 at 11:42
  • I am really, really sorry. Yes that was bad. Correcting. The X to replace is "Detail is provided in include X"
    – 22decembre
    Commented Jun 11 at 11:48

1 Answer 1

1

Here is an example that gathers all attachments and inserts them at the very end of your document. References are available through option addtotoc.

\documentclass[a4paper]{article}
\usepackage{mwe}
\usepackage{pdfpages}
\usepackage{hyperref}

\ExplSyntaxOn
\tl_new:N\pdfpages_attachments
\NewDocumentCommand\attach{ mmm }{
  \tl_put_right:Nn\pdfpages_attachments{
    \includepdf[
      pages=1-3,
      pagecommand={},
      addtotoc={1, section, 1, #1, #3}
    ]{#2}}
}
\NewDocumentCommand\outputAttachments{}{
  \tl_use:N\pdfpages_attachments
}
\NewDocumentCommand\refAttachment{m}{
  \hyperref[#1]{\autoref*{#1} (\nameref*{#1})}
}
\ExplSyntaxOff

\pagestyle{headings}
\begin{document}
\tableofcontents
%\newpage

\section{Roof}
\lipsum[1-4]

See \refAttachment{sec:att-roof}, page \pageref{sec:att-roof}.
\attach{Calculation Roof}{example-image-a4-numbered.pdf}{sec:att-roof}

\section{Wall}
\lipsum[1-4]

See \refAttachment{sec:att-wall}, page \pageref{sec:att-wall}.
\attach{Calculation Wall}{example-image-a4-numbered.pdf}{sec:att-wall}

\appendix
\outputAttachments
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .