如何获取页脚中每页内所有图形的数量

如何获取页脚中每页内所有图形的数量

我有一份包含多个图表和页脚格式的文档。我需要该页脚格式中每页图表的编号,如下所示,

在此处输入图片描述

以下代码仅包含部分图形,而不是全部,以免文章太长

\documentclass[12pt]{article}
    \usepackage{fancyhdr}
    \usepackage[paperheight=17in, paperwidth=11in, left=3cm, right=2cm, top=2cm, bottom=5.5cm, footskip=2cm]{geometry}
    \usepackage{graphicx}
    \usepackage[utf8]{inputenc}
    %\usepackage{showframe}
    \usepackage{float}
    \usepackage[labelfont={bf}]{caption}
    \usepackage[caption = false]{subfig}

    \usepackage{lastpage}

    \usepackage{multirow}
    \usepackage{array}

    \renewcommand{\figurename}{FOTOGRAFÍA}
    \renewcommand{\familydefault}{\sfdefault}
    \renewcommand{\headrulewidth}{0pt}

    \fancyfoot[C]{%
        \begin{tabular}{|m{6cm}|m{12cm}|m{3.5cm}|}
            \hline
            \multirow{1}{6cm}{} & \centering \footnotesize\textbf{CONTRATO 086 DE 2015} & \multirow{5}{3.5cm}{\centering\textbf{Page \thepage \hspace{1pt} of \pageref{LastPage}}}\\
            \cline{2-2}
            \centering\includegraphics[width=5cm]{rotulo/fondo_adap.png} & \centering \footnotesize\textbf{INTERVENTORÍA INTEGRAL A LA EJECUCIÓN DE LAS OBRAS DE URBANISMO DE LA FASE I Y EQUIPAMIENTOS DEL REASENTAMIENTO URBANO DEL MUNICIPIO DE GRAMALOTE} & \\
            \hline
            \centering\includegraphics[width=5cm]{rotulo/ru.png} & \centering\textbf{INFORME MENSUAL DE INTERVENTORÍA Nº 25} & \footnotesize\centering 27 de marzo a 26 de abril de 2019 \tabularnewline
            \hline
        \end{tabular}%
    }

    \begin{document}

        \pagestyle{fancy}
    %   \null
        \vfill

        \begin{figure}[p]
            \centering
            \captionsetup{justification=centering, margin=2cm}
            \includegraphics[width=16cm]{figuras/fig_1.png}
            \caption{Instalación de malla electrosoldada y acero de refuerzo en zona de pozos de inspección y sumideros y fundida de MR-41 en la vía del eje 9 abscisas k0+093 a la k0+185.}
        \end{figure}

        \vfill

        \begin{figure}[p]
            \centering
            \captionsetup{justification=centering, margin=2cm}
            \includegraphics[width=16cm]{figuras/fig_2.png}
            \caption{Instalación de malla electrosoldada y fundida de andén en concreto en ambos márgenes abscisas k0+270 a la k0+360 de la vía del eje 9.}
        \end{figure}

        \vfill

            \begin{figure}[p]
            \centering
            \captionsetup{justification=centering, margin=2cm}
            \includegraphics[width=16cm]{figuras/fig_3.png}
            \caption{Instalación de base granular y bordillo interno en ambos márgenes de la vía eje 9 abscisas k0+140 a la k0+270.}
        \end{figure}

        \vfill

            \begin{figure}[p]
        \centering
        \captionsetup{justification=centering, margin=2cm}
        \includegraphics[width=16cm]{figuras/fig_4.png}
        \caption{Instalación de bordillos en concreto para la vía restringida 3.}
    \end{figure}

    \vfill

    \end{document}

答案1

此解决方案使用\figlabel生成\label名为figlist.1figlist.2、... 的 。 \figlist将包含本页上的图形列表,并由 生成\makefiglist。需要运行两次才会出现任何内容。

我不确定您想将\figlist页脚放在什么位置,或者希望如何设置格式,但这应该很容易更改。在最后一个数字前添加“and”并不容易。

\documentclass[12pt]{article}
\usepackage{fancyhdr}
\usepackage[paperheight=17in, paperwidth=11in, left=3cm, right=2cm, top=2cm, bottom=5.5cm, footskip=2cm]{geometry}
\usepackage[draft]{graphicx}% get rid of all the error messages
\usepackage[utf8]{inputenc}
%\usepackage{showframe}
\usepackage{float}
\usepackage[labelfont={bf}]{caption}
\usepackage[caption = false]{subfig}

\usepackage{lastpage}
\usepackage{refcount}% for \getpagerefnumber

\usepackage{multirow}
\usepackage{array}

\renewcommand{\figurename}{FOTOGRAFÍA}
\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\headrulewidth}{0pt}

\newcounter{figdone}% you need to format \thefigdone the same as \thefigure
\setcounter{figdone}{1}
\newcommand{\figlabel}{\label{figlist.\thefigure}}% must be called after EVERY figure \caption
\newcommand{\figlist}{}% reserve global name
\newcommand{\makefiglist}{\global\let\figlist=\empty
  \loop\ifnum\getpagerefnumber{figlist.\thefigdone}=\value{page}% check this page
    \ifx\empty\figlist\relax
      \xdef\figlist{Fig. \thefigdone}%
    \else
      \xdef\figlist{\figlist, \thefigdone}%
    \fi
    \stepcounter{figdone}% check next figure
  \repeat}


\fancyfoot[C]{\makefiglist
    \begin{tabular}{|m{6cm}|m{12cm}|m{3.5cm}|}
        \hline
        \multirow{1}{6cm}{} & \centering \footnotesize\textbf{CONTRATO 086 DE 2015} & \multirow{5}{3.5cm}{\centering\textbf{Page \thepage \hspace{1pt} of \pageref{LastPage}}}\\
        \cline{2-2}
        \centering\includegraphics[width=5cm]{rotulo/fondo_adap.png} & \centering \footnotesize\textbf{INTERVENTORÍA INTEGRAL A LA EJECUCIÓN DE LAS OBRAS DE URBANISMO DE LA FASE I Y EQUIPAMIENTOS DEL REASENTAMIENTO URBANO DEL MUNICIPIO DE GRAMALOTE} & \figlist \\
        \hline
        \centering\includegraphics[width=5cm]{rotulo/ru.png} & \centering\textbf{INFORME MENSUAL DE INTERVENTORÍA Nº 25} & \footnotesize\centering 27 de marzo a 26 de abril de 2019 \tabularnewline
        \hline
    \end{tabular}%
}

\begin{document}

    \pagestyle{fancy}
%   \null
    \vfill

    \begin{figure}[p]
        \centering
        \captionsetup{justification=centering, margin=2cm}
        \includegraphics[width=16cm]{figuras/fig_1.png}
        \caption{Instalación de malla electrosoldada y acero de refuerzo en zona de pozos de inspección y sumideros y fundida de MR-41 en la vía del eje 9 abscisas k0+093 a la k0+185.}\figlabel
    \end{figure}

    \vfill

    \begin{figure}[p]
        \centering
        \captionsetup{justification=centering, margin=2cm}
        \includegraphics[width=16cm]{figuras/fig_2.png}
        \caption{Instalación de malla electrosoldada y fundida de andén en concreto en ambos márgenes abscisas k0+270 a la k0+360 de la vía del eje 9.}\figlabel
    \end{figure}

    \vfill

        \begin{figure}[p]
        \centering
        \captionsetup{justification=centering, margin=2cm}
        \includegraphics[width=16cm]{figuras/fig_3.png}
        \caption{Instalación de base granular y bordillo interno en ambos márgenes de la vía eje 9 abscisas k0+140 a la k0+270.}\figlabel
    \end{figure}

    \vfill

        \begin{figure}[p]
    \centering
    \captionsetup{justification=centering, margin=2cm}
    \includegraphics[width=16cm]{figuras/fig_4.png}
    \caption{Instalación de bordillos en concreto para la vía restringida 3.}\figlabel
\end{figure}

\vfill

\end{document}

答案2

这远非完美,更像是一个概念证明......

也许有人会滥用脚注来保存每页的图表编号。下面是一个简短的例子:

\documentclass{article}

\usepackage{etoolbox}
\AfterEndEnvironment{figure}{\footnotetext{\thefigure}}

\usepackage[para]{footmisc}

\makeatletter
\def\@makefnmark{}
\renewcommand\footnoterule{}
  \long\def\makefootnoteparagraph{\unvbox\footins \makehboxofhboxes
    \setbox\FN@tempboxa=\hbox{\unhbox\FN@tempboxa \removehboxes}
    \hsize\columnwidth
    \@parboxrestore
    \baselineskip=\footnotebaselineskip
    \noindent
    \rule{\z@}{\footnotesep}%
    Figures \unhbox\FN@tempboxa\par
  }
\makeatother

\begin{document}

\begin{figure}[htbp]
\caption{a}
\end{figure}
\begin{figure}[htbp]
\caption{a}
\end{figure}
\begin{figure}[htbp]
\caption{a}
\end{figure}

\newpage

\begin{figure}[htbp]
\caption{a}
\end{figure}
\begin{figure}[htbp]
\caption{a}
\end{figure}
\begin{figure}[htbp]
\caption{a}
\end{figure}


\end{document}

相关内容