Como obter um número de página ao lado de uma palavra automaticamente

Como obter um número de página ao lado de uma palavra automaticamente

Eu tenho um arquivo de palavras. Eu usei o ambiente longtable. Gostaria de adicionar números de página de algumas outras palavras a algumas palavras.

Não sei como fazer isso automaticamente, porque posso alterar o formato da página ou adicionar algumas palavras novas e depois mudarei as palavras de posição - e mudarei os números das páginas. A tabela abaixo é isso que quero dizer.

+--------+---------------+-----------------------------------------------+
| word_a | pronunciation | meaning, (the page number of the word word_g) |
| ...    | ...           | ...                                           |
| page 8                                                                 |
+--------+---------------+-----------------------------------------------+  
| ...    | ...           | ...                                           |
| page 9                                                                 |
+--------+---------------+-----------------------------------------------+
| word_g | pronunciation | meaning, (the page number of the word word_a),|
|        |               | (the page number of the word word_g)          |
| ...    | ...           | ...                                           |   
| page 10                                                                |
+--------+---------------+-----------------------------------------------+
| ...    | ...           | ...                                           | 
+--------+---------------+-----------------------------------------------+

MWE

\documentclass[10pt,a5paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[main=slovak,english]{babel}
\usepackage[a5paper, top=15mm, left=10mm, right=10mm, bottom=10mm,foot=5mm,marginparsep=0mm]{geometry}
\usepackage{longtable}
\usepackage{tipa}
\usepackage{ wasysym}
\usepackage{ amssymb }

%skratky
%---
\newcommand*{\podm}{\textit{\small [noun]} }
\newcommand*{\pridm}{\textit{\small [adj]} }
\newcommand*{\zamen}{\textit{\small [pronoun]} }
\newcommand*{\pris}{\textit{\small [adverb]} }
\newcommand*{\cislo}{\textit{\small [number]} }
\newcommand*{\slo}{\textit{\small [verb]} }
\newcommand*{\pred}{\textit{\small [preposition]} }
\newcommand*{\spoj}{\textit{\small [conjunction]} }
\newcommand*{\cit}{\textit{\small [exclamation]} }
%---
\newcommand*{\jedc}{\textit{\small [singular]} }
\newcommand*{\mnoc}{\textit{\small [plural]} }
\newcommand*{\poc}{\textit{\small [C]} }
\newcommand*{\nep}{\textit{\small [U]} }
\newcommand*{\CU}{\textit{\small [C, U]} }
\newcommand*{\jed}{\textit{\small [S]} }
\newcommand*{\slot}{\textit{\small [T]} }
\newcommand*{\sloi}{\textit{\small [I]} }
\newcommand*{\ubn}{\textit{\small [usually before noun]} }
\newcommand*{\us}{\textit{\small [usually singular]} }
\newcommand*{\up}{\textit{\small [usually plural]} }
\newcommand*{\nbn}{\textit{\small [not before noun]} }
\newcommand*{\obn}{\textit{\small [only before noun]} }
\newcommand*{\bn}{\textit{\small [before noun]} }
\newcommand*{\nubn}{\textit{\small [not usually before noun]} } 
%---
\newcommand*{\UK}{{\small (UK) }}
\newcommand*{\US}{{\small (US) }}
\newcommand*{\SR}{{\small (SR) }}
%---
\newcommand*{\fone}{\fontfamily{qag}\selectfont} % Eng word
\newcommand*{\ftwo}{\fontfamily{phv}\selectfont} % pronunciation
\newcommand*{\fthree}{\fontfamily{ccr}\selectfont} %
\newcommand*{\ffour}{\fontfamily{pag}\selectfont} % 
%--
\newcommand*{\tm}{\small \fontfamily{ccr}\selectfont} % komentar
%---
\newcommand*{\frm}{\textit{\small (formal)} }
\newcommand*{\ifrm}{\textit{\small (informal)} }
\newcommand*{\app}{\textit{\small (approving)} } 
\newcommand*{\pc}{\textit{\small (computing)} }
\newcommand*{\osh}{\textit{\small (old-fashioned)} }
\newcommand*{\slg}{\textit{\small (slang)} }
\newcommand*{\mat}{\textit{\small (mathematics)} }
\newcommand*{\chem}{\textit{\small (chemistry)} }
\newcommand*{\lit}{\textit{\small (literary)} }
\newcommand*{\mus}{\textit{\small (music)} } 
\newcommand*{\fin}{\textit{\small (finance)} }
\newcommand*{\gem}{\textit{\small (geometry)} }
\newcommand*{\gmm}{\textit{\small (grammar)} } 
\newcommand*{\bus}{\textit{\small (business)} } 
\newcommand*{\law}{\textit{\small (law)} } 
\newcommand*{\phs}{\textit{\small (physics)} } 
\newcommand*{\frrm}{\textit{\small (rather formal)} }
\newcommand*{\irrm}{\textit{\small (rather informal)} }
\newcommand*{\sth}{\textit{\small sth }}
\newcommand*{\stb}{\textit{\small sb }}
\newcommand*{\tboo}{\textit{\small (taboo)} }
\newcommand*{\sla}{\textit{\small (slang)} }
\newcommand*{\odi}{\textit{\small (often disapproving)} }
\newcommand*{\bis}{\textit{\small (business)} }
\newcommand*{\diss}{\textit{\small (disapproving)} }
\newcommand*{\ling}{\textit{\small (linguistics)} }

\begin{document}
\catcode`\-=12
\sloppy

\begin{longtable}{llp{5cm}}
  {\fone lime } & {\ftwo [\textipa{laIm }] } & \podm \nep vápno $\square$ \CU limetka $\square$ \poc {\fone lime tree, linden tree } {\ftwo [\textipa{\textprimstress lIn.d@n }] } lipa \\
  {\fone avenue } & {\ftwo [\textipa{\textprimstress \ae [email protected]: }] } & \podm \poc avenue, alej, bulvár \textit{\tm (Ave., Av.)}  \\
  {\fone lane } & {\ftwo [\textipa{leIn }] } & \podm \poc poľná cesta $\square$ \poc jazdný pruh, dopravný pás \\
  {\fone grove } & {\ftwo [\textipa{gr@Uv }] } & \podm \poc háj, lesík \\

  %---
  \newpage
  %---

  {\fone ancient } & {\ftwo [\textipa{\textprimstress eIn.S\super @nt }] } & \pridm staroveký $\square$ starý, starobylý, starodávny $\square$ \mnoc {\fone the ancients } staroveké národy  \\
  {\fone navigation } & {\ftwo [\textipa{\textsecstress n\ae v. I\textprimstress geI.S\super @n }] } & \podm \nep navigácia $\square$ riadenie lode, let  \\
  {\fone sailor } & {\ftwo [\textipa{\textprimstress seI.l@\super r }] } & \podm \poc námorník, lodník $\square$    \\

  %---
  \newpage
  %---

  {\fone compass } & {\ftwo [\textipa{\textprimstress k2m.p@s }] } & \podm \poc kompas  \\
  {\fone approximate } & {\ftwo [\textipa{@\textprimstress pr6k.sI.m@t }] } & \pridm približný  \\
  {\fone exact$^{1000}$} & {\ftwo [\textipa{Ig\textprimstress z\ae kt }] } & \pridm presný, bezchybný, exaktný   \\ 
\end{longtable}


\end{document}

Responder1

Conforme afirmado pelos comentários, usar glossariesé provavelmente a melhor solução. Porém, se quiser manter sua abordagem original, você pode usar combinações de labele pageref, para as quais o segundo mostrará o número da página do primeiro.

MWE:

\documentclass{article}
\usepackage[a6paper,landscape]{geometry}
\usepackage{longtable}

\begin{document}
\begin{longtable}{|l|l|}
\hline
word a & meaning a (see also page \pageref{wordb})\\\hline
\newpage
\hline
word b\label{wordb} & meaning b\\\hline
\end{longtable}
\end{document}

Resultado:

insira a descrição da imagem aqui

informação relacionada