# Cross-referencing numeric values and text from later section to executive summary of a latex document

I have almost completed drafting a report on consumption of different food items, and I am drafting an executive summary so that readers can quickly know what the report is about. Since there are quite a lot of tables and ranking and number generated from the dataset, I need to cross-reference quite a number of them in the executive summary, which I don't prefer "hard-code" these figures into the executive summary by means of copy and paste.

Having explored that use of macro maybe my way out, but it has a limitation that text to be quoted needs to present before where it needs to be quoted, which is not applicable to my case as the executive summary needs to present before the main text

Can anyone enlighten me on how to cross-reference the text or numbers from a later section in latex without manually copy and paste?

Thanks!

• Welcome to TeX.SX! Please provide a minimal working example showing what you've tried so far. – user156344 Dec 17 '18 at 11:16
• How are the numbers and text you want to quote generated? Are they hard coded, or are they being produced by a tool. If they are hardcoded, and not too numerous, the simplest thing would be to define macros for them in the preamble, and then use those macros both in the executive summary and the later section. – Paul Stanley Dec 17 '18 at 11:22
• Paul, I am using R markdown that R script is integrated into the R markdown file for generating the figures, they are fairly lot script that moving them to preamble needs quite a lot of effort – lokheart Dec 17 '18 at 11:27

You can e.g. use a label/ref:

\documentclass[11pt]{article}
\makeatletter
\newcommand\store[2]{#1{\def\@currentlabel{#1}\label{#2}}}

\begin{document}

\section{Use}
\ref{text}, \ref{number}

\section{Store}
here ist the text \store{some text}{text}
\store{123456}{number}

\end{document}