2

I used the code from Cross-referencing to included PDF with counter and argument in the label and also from Bates numbering of multiple pdfs with label reference to the page numbers.

In my quest for bates numbering, all now seems to work with exception of the toc:

enter image description here

The sections look good, as follows:

enter image description here

The LaTeX code I used (using the quickcode.tex document in The first reference to create pdfs 10.pdf and 18.pdf) to make the examples follows:

\documentclass[12pt,letterpaper,fleqn,parskip=half]{scrartcl}
\usepackage{bookman}
\usepackage{lscape}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx}
\usepackage[scaled]{helvet}
\usepackage{caption}
\usepackage[breaklinks=true,colorlinks=true,linkcolor=black,citecolor=black,urlcolor=black]{hyperref}
\usepackage{xargs}                                          

%---------------------------------------------------------------------
%   % Macro to include PDF document with page numbers in caption and label
%---------------------------------------------------------------------
\newcounter{imagepage}

\makeatletter
\newcommandx{\picTEST}[5][1=0.9, 2=0]
{\pdfximage{#4}
\setcounter{imagepage}{0} 
\@whilenum\value{imagepage}<\pdflastximagepages\do{%
    \stepcounter{imagepage}
    \begin{figure}[h!]
     \centering
     \includegraphics[width=#1\textwidth,page=\value{imagepage},angle=#2]{#4}
     \caption{#5 - Page \arabic{imagepage} of {\the\pdflastximagepages}}
     \label{#3\theimagepage}
    \end{figure}
    \clearpage}}
\makeatother

\usepackage{fmtcount}
\renewcommand{\thesection}{\ORDINALstring{section} POINT}
\renewcommand{\thesubsection}{\arabic{subsection}}

\usepackage{xpatch} \makeatletter 
\xpatchcmd{\tableofcontents}{\contentsname \@mkboth}{\LARGE\uppercase\contentsname\@mkboth}{}{} 
\makeatother


\addtokomafont{disposition}{\rmfamily}


\begin{document}

\Large
\clearpage
\begingroup
\areaset{\paperwidth}{\paperheight}
\renewcommand{\figurename}{RECORD PAGE}
\picTEST{Transcript1_Label_Page}{10.pdf}{Transcript, September 1, 2010}
\picTEST{Transcript2_Label_Page}{18.pdf}{Transcript, February 23, 2011}


\endgroup

\tableofcontents

\newpage

 \setcounter{page}{1}

 \section{~} 

\subsection{All Cows Eat Grass}

Here is reference to page \ref{Transcript2_Label_Page3} of the included PDF document, proving that:

The grass is greener...
\section{~}

]5

So, if anyone knows how to eliminate the repeating section headings in the table of contents, that would be wonderful.

2

You also get a bunch of errors, so the output is essentially arbitrary.

The command \ORDINALstring is fragile, but, more importantly, it is not fully expandable. So you have to use \ORDINALstringnum{\arabic{section}} after having robustified the fmtcount command:

\usepackage{etoolbox} % loaded by xpatch
\renewcommand{\thesection}{\ORDINALstringnum{\arabic{section}} POINT}
\robustify{\ORDINALstringnum}

You're better to load all packages first, then apply the customizations.

Also note that issuing \Large at the beginning is not the best thing to do. The results will not be satisfying at all. Also using \pdfximage directly doesn't seem very portable.

Finally \uppercase\contentsname is a very good way to look for trouble, as \uppercase is not a macro taking an argument. It should be

\MakeUppercase{\contentsname}

I have also fixed the order of package loading.

\documentclass[12pt,letterpaper,fleqn,parskip=half]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{lscape}
\usepackage{graphicx}

\usepackage{bookman}
\usepackage[scaled]{helvet}

\usepackage{caption}
\usepackage{xargs}                                          
\usepackage{fmtcount}
\usepackage{xpatch}
\usepackage[breaklinks=true,colorlinks=true,linkcolor=black,citecolor=black,urlcolor=black]{hyperref}

%---------------------------------------------------------------------
%   % Macro to include PDF document with page numbers in caption and label
%---------------------------------------------------------------------
\newcounter{imagepage}

\makeatletter
\newcommandx{\picTEST}[5][1=0.9, 2=0]
{\pdfximage{#4}
\setcounter{imagepage}{0} 
\@whilenum\value{imagepage}<\pdflastximagepages\do{%
    \stepcounter{imagepage}
    \begin{figure}[h!]
     \centering
     \includegraphics[width=#1\textwidth,page=\value{imagepage},angle=#2]{#4}
     \caption{#5 - Page \arabic{imagepage} of {\the\pdflastximagepages}}
     \label{#3\theimagepage}
    \end{figure}
    \clearpage}}
\makeatother

\renewcommand{\thesection}{\ORDINALstringnum{\arabic{section}} POINT}
\renewcommand{\thesubsection}{\arabic{subsection}}
\robustify{\ORDINALstringnum}

\makeatletter 
\xpatchcmd{\tableofcontents}{\contentsname \@mkboth}{\LARGE\MakeUppercase{\contentsname}\@mkboth}{}{} 
\makeatother


\addtokomafont{disposition}{\rmfamily}


\begin{document}

\begingroup
\Large
\areaset{\paperwidth}{\paperheight}
\renewcommand{\figurename}{RECORD PAGE}
\picTEST{Transcript1_Label_Page}{example-image.pdf}{Transcript, September 1, 2010}
\picTEST{Transcript2_Label_Page}{example-image.pdf}{Transcript, February 23, 2011}

\endgroup

\tableofcontents

\newpage

 \setcounter{page}{1}

 \section{~} 

\subsection{All Cows Eat Grass}

Here is reference to page \ref{Transcript2_Label_Page3} of the included PDF document, proving that:

The grass is greener...
\section{~}

\end{document}

enter image description here

Your Answer

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

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