Giter Site home page Giter Site logo

Comments (2)

dsavransky avatar dsavransky commented on July 18, 2024

Ok. I think I have a robust solution for this (but it is very, very ugly). Basic idea:

  1. Preflight - scan through LaTeX source and find all labeled equation environments (could alternatively pick up all numbered eqs, but if the point here is cross-referencing, then why number unreferenced eqs?). Could maybe make this a user toggle (number all vs. only referenced). In any case, scan through all equation, eqnarray, align (other?) envs and make dictionary of labels vs eq number.
  2. In the pandoc-generated HTML, at the same time as we're replacing the codecogs url with the canvas url, for each equation to be numbered, update as follows:
 <span style="margin: 1ex auto; display: table; text-align: center; width: 100%; vertical-align: middle;">
 <img class="equation_image" style="display: block; text-align: center; margin: 0.5rem auto;" [orig eq. content] />
 <span style="display: table-cell; text-align: left; vertical-align: middle;">([equation nmber])</span>
 </span>
  1. Update any references elsewhere in the HTML to the equation number instead of the label name (just a global replace like the others already in use).

Caveats: block math environments (eqnarray and align) can only have a single link as they are going to appear as a single image in the rendered html. The internal dict should basically just map all relevant eq. numbers to a single reference. I don't think this will be a major issue, but if people hate this, then just don't use these envs for eqs you want to reference in the text.

from grading.

dsavransky avatar dsavransky commented on July 18, 2024

Addressed by v2.9.0.

from grading.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.