openstax / oer.exports

Converter to various book formats (PDF, epub, mobi)
2 stars 0 forks source link

Chemistry => Prescripts in Formulas Crash PDF #1000

Closed nyxer95 closed 9 years ago

nyxer95 commented 9 years ago

In formulas, need to have prescripts that are subscripts and superscripts.

Discussed with Derek, Ross, and Phil, this is a transform issue with pMML2SVG (pdf).

Ross is going to look through the code to see if we can find out who created this functionality. We may be able to hire this person as a contractor.

However, it is very unlikely that we will be able to resolve this in time for Chemistry.

nyxer95 commented 9 years ago

Some of the issues found result from the use of <m:multiscripts> and <m:prescripts> tags. These tags are not allowed on CNX; the XML teams should use <m:msup> and <m:msub> instead. In Ryan’s experience, the use of multiscripts and/or prescripts tags can result in crashing a PDF.

nyxer95 commented 9 years ago

An example of this can be found in the following collection/module/content:

Chemistry Chapter 2 => col10094 http://staging2.cnx.org/content/col10094/latest/

Module 3 - Atomic Structure and Symbolism => m10391 http://staging2.cnx.org/content/m10391/latest/?collection=col10094/latest

Table 1.4 - Nuclear Compositions of Atoms of the Very Light Elements => http://staging2.cnx.org/content/m10391/latest/#fs-idm87646592 This table has a number of examples in the second column (Symbol)

philschatz commented 9 years ago

Tested with prince 9.0r5 and got the following PDF (looks correct) using http://www.w3.org/Math/testsuite/build/main/Topics/BiDi/ByElement/dir_mmultiscripts-full.xhtml:

image

Source:

<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <p>Hello</p>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <mn>2</mn>
      <mo>*</mo>
      <mi>x</mi>
    </math>

    <p>Test from http://www.w3.org/Math/testsuite/build/main/Topics/BiDi/ByElement/dir_mmultiscripts-full.xhtml</p>

Rather than completely regression-testing all the pmml2svg, the math could just be skipped from conversion if it contains mmultiscripts in the pmml2svg transform and let prince handle it.

InconceivableVizzini commented 9 years ago

multiscripts example

It's sort of ugly, but I've isolated multiscripts. Any mathml math node which contains a multiscript will be rendered with princexml and NOT converted to an image.

InconceivableVizzini commented 9 years ago

screen shot 2015-03-09 at 4 10 49 pm

philschatz commented 9 years ago

@InconceivableVizzini can you ref the commit or PR in this issue (so I can take a look ; )?

nyxer95 commented 9 years ago

Derek fixed this issue using PrinceXML locally. Need to update PrinceXML on naginata, staging servers, and QA to test.

nyxer95 commented 9 years ago

PrinceXML has been updated on the staging servers. Upgraded math is not available.