PCCMathSAC / apex-mbx

Repository for a conversion of APEX Calculus to MathBook XML
2 stars 10 forks source link

xml ids for more images #32

Closed davidfarmer closed 8 years ago

davidfarmer commented 8 years ago

Add xml:id's for a few more images.

Probably there are more to be done, but this at least takes care of a dozen or so.

Accept this before the pull prettyprint pull request, at which time I will have to re-do the other pull request.

Alex-Jordan commented 8 years ago

Not counting what this will reduce it to, there are 480 latex-image-code images that are still being created as image-xxx.xsl instead of with a perma-name. The second section, sec_limit_def.mbx has these lines:

<!-- START figures/fig_limit_proof1a.tex --> 
<image>
...
<!-- START figures/fig_limit_proof1b.tex -->
<image>
...

all within the same figure (whose xml:id is totally different: xml:id="fig_choose_e_d). Have you thought about matching instances of

<!-- START figures/fig_(foo).tex -->
<image>

and replacing them with

<!-- START figures/fig_foo.tex -->
<image xml:id="image_foo">

?

One thing I could see going wrong there would be a duplicated xml:id, but xmllint should catch that.

Alex-Jordan commented 8 years ago

Sorry, my example from sec_limit_def.mbx is one you already got. I lost track of which branch I was viewing. The first example I find of an image that is missing an xml:id is in sec_extreme_values.mbx. There we have

<figure xml:id="fig_extreme" >
<caption>Graphs of functions with and without extreme values.</caption>
<sidebyside><figure>
<caption>(a)</caption>
<!-- START figures/fig_extreme1.tex -->
<image>
<description></description>
<latex-image-code><![CDATA[
\begin{tikzpicture}
\begin{axis}[ ymin=-.9,ymax=5.5,xmin=-2.2,xmax=2.2,]

\addplot [thick,{\colorone},smooth,domain=-2:2] {-x^2+5};

\filldraw [thick,{\colorone},fill=white] (axis cs:2,1) circle (1.5pt);
\filldraw [thick,{\colorone},fill=white] (axis cs:-2., 1) circle (1.5pt);

\draw [thick] (axis cs:-2,0) node {\textbf{(}};
\draw [thick] (axis cs:2,0) node {\textbf{)}};
\draw [ultra thick] (axis cs:-2,0) -- (axis cs:2,0);
\end{axis}

\end{tikzpicture}
]]></latex-image-code>
</image>
<!-- figures/fig_extreme1.tex END -->

</figure>

which is a single image within one figure.

davidfarmer commented 8 years ago

The problem with that example is that it is figure within a sidebyside within a figure. There are many similar examples.

My assumption was: this is a conversion error and the markup needs to be changed.

If that markup is correct, then I can do something about the id of the image. But if that markup should be changed, then let's take care of that first.

On Mon, 5 Sep 2016, Alex Jordan wrote:

Sorry, my example from sec_limit_def.mbx is one you already got. I lost track of which branch I was viewing. The first example I find of an image that is missing an xml:id is in sec_extreme_values.mbx. There we have

Graphs of functions with and without extreme values.
(a)

which is a single image within one figure.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LHw59mKRDrVZSMX9cCwPZ93RbB1Bks5qnPhfgaJpZM4J1ZoY.gif]

Alex-Jordan commented 8 years ago

OK, I'll look more closely at these kinds of examples. But one possibility is that there are too many cases that need to be handled differently, manually. And in all cases, I don't see harm in giving the image an xml:id right now if its original source file prefix is known.

davidfarmer commented 8 years ago

I don't see harm in giving the image an xml:id right now if its original source file prefix is known.

The problem is that I wrote quick-and-dirty code that does not do a good job on nested environments. If I am going to do it properly, then I might as well also fix the markup.

Alex-Jordan commented 8 years ago

I didn't catch before that the xml:ids here used "fig" for prefix instead of "img". I just changed them all to img and pushed (as well as some from the intro limits section where I had used "image" as a prefix manually).