Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equation numbering via pandoc-eqnos breaks DOCX output #435

Open
ch728 opened this issue Aug 24, 2021 · 10 comments
Open

Equation numbering via pandoc-eqnos breaks DOCX output #435

ch728 opened this issue Aug 24, 2021 · 10 comments

Comments

@ch728
Copy link

ch728 commented Aug 24, 2021

How do I configure manubot to get docx output? I read something about changing an environment variable. This is my repo https://github.com/ch728/cucurbit-usda .

@agitter
Copy link
Member

agitter commented Aug 24, 2021

This is controlled with an environment variable, BUILD_DOCX=true. For your manuscript you can enable that for all GitHub Actions builds by adding

      BUILD_DOCX: true

after this line in the env: section of the workflow https://github.com/ch728/cucurbit-usda/blob/3d5373de4166dd9b4a60491fe6dca6ff0c0142fb/.github/workflows/manubot.yaml#L17

You should then have the docx written to https://github.com/ch728/cucurbit-usda/tree/output with every main branch build. It will also be saved in the GitHub Actions artifacts if you want to review the docx during pull request builds.

@ch728
Copy link
Author

ch728 commented Aug 24, 2021

Thank you, I go the docx to build but when I tried to open it I saw this error:
Screenshot from 2021-08-24 14-39-25

@agitter
Copy link
Member

agitter commented Aug 24, 2021

That's a new issue. I can't open the docx in Word 2016 either
image

The XML at that referenced location is

<w:bookmarkStart w:id="0" w:name="eq:regular-equation"/><w:r><w:t></w:p><w:p><w:pPr><w:pStyle w:val="BodyText" />

Chrome tells me

This page contains the following errors:
error on line 1 at column 50422: Opening and ending tag mismatch: t line 1 and p

which is this part <w:t></w:p>.

That looks like it is near or part of Equation 1.
image

If you delete that equation, does the docx work? If we determine the error is due to a single equation, we could create a minimal example and report it to pandoc.

@ch728
Copy link
Author

ch728 commented Aug 24, 2021

I had to delete both equation lines to get rid of the error.

@ch728
Copy link
Author

ch728 commented Aug 24, 2021

So after playing around with it some more, it's appears to be the addition of the equation tags like {#eq:long-equation} that causes the issue.

@agitter
Copy link
Member

agitter commented Aug 24, 2021

This looks like the same error reported in tomduck/pandoc-eqnos#60

@ch728
Copy link
Author

ch728 commented Aug 24, 2021

Ah, yup! Well I will go ahead and close this issue because my initial question was answered and this equation thing is already logged as an issue. Thank you.

@ch728 ch728 closed this as completed Aug 24, 2021
@dhimmel
Copy link
Member

dhimmel commented Sep 1, 2021

How do I configure manubot to get docx output? I read something about changing an environment variable.

Noting a new feature introduced by #436. If you upgrade to the latest rootstock, you can use "workflow dispatch", or an ad-hoc CI run which has a menu option for setting BUILD_DOCX to true.

I will go ahead and close this issue because my initial question was answered and this equation thing is already logged as an issue.

I'm going to go ahead and reopen and rename this issue since we would like equation numbers to work with DOCX outputs (or at least fail more gracefully).

@dhimmel dhimmel reopened this Sep 1, 2021
@dhimmel dhimmel changed the title How do I get docx output? Equation numbering via pandoc-eqnos breaks DOCX output Sep 1, 2021
@dhimmel
Copy link
Member

dhimmel commented Mar 17, 2022

Perhaps time that we look into replacing pandoc-eqnos with pandoc-crossref, since it appears to be more actively maintained.

@agitter
Copy link
Member

agitter commented Mar 18, 2022

I briefly started looking into pandoc-crossref in a demo manuscript. See agitter/my-manuscript#22

I committed the HTML output before and after switching to pandoc-crossref so we could see the diff. There are enough differences to break some of our plugins, but they don't look insurmountable. One annoying difference is that it prints prefixes so "Figure 1" becomes "Figure fig. 1". It's possible to suppress those prefixes, but that has to be done for every reference. Maybe it can be overridden globally with an empty reference format or a reference template. There are a lot of customization options.

It's installable through conda-forge.

Edit: I didn't check the PDF output. The equation numbering works in the DOCX output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants