Hey folks,
I have run into some issues with processing my files with xsltproc and pdflatex in terms of cross-references not working. Try as I might, I can't track down the source nor find a solution.
Here's my issue. I have a book project mt.xml which currently contains a few figures generated using tikz. The figures render fine when I process with xsltproc and pdflatex into a .pdf output file. So far, so good. But I have cross-referenced them in the text using <xref ref="foo"> in reference to the @xml:id attribute on the figure. (This has worked fine with lists and equations.) However, pdflatex is throwing some errors (see below) and pretext also throws out some confusing PTX:ERRORs (also below).
I have attached the relevant portions of my .xml file and a screenshot of the .pdf output below. Not sure if it matters but I'm running bash on Windows 10 via WSL.
I am sure there is something simple I am missing. I am new to using @xml:id and @xref elements.
when running "xsltproc -o mt.tex /Documents/Micro_Text_Project/mathbook/xsl/pretext-latex.xsl src/mt.xml" in bash. (note: these errors/warnings appear multiple times)
PTX:ERROR: An object (image) lacks a serial number, search output for "[NUM]"
located within: "kumquat-demand-tikz" (xml:id)
PTX:ERROR: An object (image) lacks a structure number, search output for "[STRUCT]"
located within: "kumquat-demand-tikz" (xml:id)
MBX:WARNING: could not translate string with id "image" into language for code "en-US"
when running pdflatex:
LaTeX Warning: Hyper reference `x:figure:kumquat-demand-tikz' on page 5 undefin
ed on input line 538.
LaTeX Warning: Reference `x:figure:kumquat-demand-tikz' on page 5 undefined on
input line 538.
[5]
LaTeX Warning: Hyper reference `x:figure:kumquat-demand-tikz' on page 6 undefin
ed on input line 550.
LaTeX Warning: Reference `x:figure:kumquat-demand-tikz' on page 6 undefined on
input line 550.
[6]
Here is what is generated in the mt.tex file.
where xref occurs:
\hyperref[x:figure:kumquat-demand-tikz]{Figure~{\xreffont\ref{x:figure:kumquat-demand-tikz}}}
and where xml:id is used:
\begin{figureptx}{Kumquat Demand}{x:figure:kumquat-demand-tikz}{}%
\begin{image}{0.25}{0.5}{0.25}%
\resizebox{\linewidth}{!}{%
\begin{tikzpicture} scale=1
From mt.xml:
<p>
Now that we have introduced the idea of inverse demand, let's connect it to what you have likely seen before as a demand
curve. <xref ref="kumquat-demand-tikz"/> below illustrates a simple linear inverse demand curve for kumquats. This shows us the quantity, price
pairs representing demand for this fruit, taken all other variables impacting kumquat demand as given or constant. A change
in one of these other variables leads to a change in the quantity demanded at each price, shifting the curve left or right.
Looking at the impact on the demand curve of a change in a single
non-price variable like this is called <em>comparative statics</em>.
</p>
<p>
So let us consider what would happen [WORKING HERE]
</p>
<figure xml:id="kumquat-demand-tikz">
<caption>Kumquat Demand</caption>
<image width="50%">
<description>A graph of kumquat demand.</description>
<latex-image>
\begin{tikzpicture} scale=1
\draw[\lt-\gt,thick] (0,25) node (yaxis) [above] {$P$} |- (15,0) node (xaxis) [right] {$Q$};
\draw (0,23) coordinate (b_1) -- (11.5, 0) coordinate (b_2);
\coordinate(c) at (9,5);
\draw[dashed] (yaxis |- c) node[left] {$5$}
-| (xaxis -| c) node [below] {$9$};
\fill [red] (c) circle (3 pt);
\end{tikzpicture}
</latex-image>
</image>
</figure>
Figure and missed reference section of .pdf: