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

docx manuscript fails to open on MS word #331

Open
cgreene opened this issue Mar 16, 2022 · 7 comments
Open

docx manuscript fails to open on MS word #331

cgreene opened this issue Mar 16, 2022 · 7 comments

Comments

@cgreene
Copy link
Contributor

cgreene commented Mar 16, 2022

We've got a manuscript here where we're not able to open in microsoft word on mac when building with the latest rootstock:
https://github.com/greenelab/nature_news_manuscript/blob/output/manuscript.docx

Has anyone else experienced this before?

@nrosed
Copy link

nrosed commented Mar 16, 2022

So I was able to get it to work by changing citeproc to pandoc-citeproc in build/pandoc/defaults/common.yaml

Not sure if this is the most correct fix... I also tried just commenting out citeproc, but this did not work. I did this because I thought citeproc was already included in pandoc and the extra filter was not needed.

You can see the commit here: greenelab/nature_news_manuscript@e042065

@nrosed
Copy link

nrosed commented Mar 16, 2022

Also, this was after updating rootstock and rebuilding my environment (greenelab/nature_news_manuscript#16)

@agitter
Copy link
Member

agitter commented Mar 16, 2022

I can't open your linked docx file in Word on Windows either. I could open a recent docx from the COVID-19 review though.

The error from Word points to this part of the XML

<w:t xml:space="preserve">2</w:t></w:r></w:hyperlink><w:r><w:t xml:space="preserve">.</w:t></w:r><w:r><w:t xml:space="preserve"> </w:t></w:r><w:r><w:t xml:space="preserve">We did not consider any names where no prediction could be made or quotes where neither speaker nor gendered pronoun was associated.</w:t></w:r></w:p><w:p><w:pPr><w:pStyle w:val="BodyText" /></w:pPr><w:bookmarkStart w:id="0" w:name="eq:quote"/><w:r><w:t></

An XML viewer reported

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

Based on where the XML syntax error occurs, it points to a problem exporting these equations to docx

$$\textrm{Prop. Male Quotes} = \frac{|\textrm{Male Speaker Quotes}|} {|\textrm{Male or Female Speaker Quotes}|}$${#eq:quote}
$$\textrm{Prop. Male First Authors} = \frac{|\textrm{Male First Authors}|} {|\textrm{Male or Female First Authors}|}$${#eq:first-author}

That's consistent with other errors with equation numbering in docx manubot/rootstock#435. The other issue linked in that thread suggests it may have started in pandoc 2.11.3.

@agitter
Copy link
Member

agitter commented Mar 22, 2022

Is this equation numbering problem blocking your resubmission? In manubot/rootstock#435 (comment) I describe initial attempts to use pandoc-crossref for numbering. It has some peculiarities and breaks some of Manubot's interactive HTML elements. However, it can export a DOCX with equation numbers that I can open.

@nrosed
Copy link

nrosed commented Mar 22, 2022

Thanks @agitter, no we were able to work around it and resubmit. I was able to get it to work somehow in the most recent build, but not sure if it is a transient issue and if it will come back later.

@miltondp
Copy link
Contributor

miltondp commented Nov 2, 2022

I ran across the same issue with this manuscript. The final Word file does not open in Word, and I get an error with LibreOffice Writer 7.3 in Ubuntu:

image

After opening it with LibreOffice Writer, though, the file is only read until it reaches Equation 1 (not showing it) in section "Methods and materials." Also, images are not shown. This used to work with previous versions of manubot/rootstock/conda environment.

As a workaround, I created an old conda environment with pandoc 2.9 and build locally. For that, I used this version of the build/environment.yml file and ran conda env create -n manubot-pandoc29 -f environment.yml. I also applied the patch by @nrosed here to use pandoc-citeproc instead of citeproc:

index bfa5d97..12c0c34 100644
--- a/build/pandoc/defaults/common.yaml
+++ b/build/pandoc/defaults/common.yaml
@@ -6,7 +6,7 @@ filters:
 - pandoc-eqnos
 - pandoc-tablenos
 - pandoc-manubot-cite
-- citeproc
+- pandoc-citeproc
 wrap: preserve
 metadata:
   csl: build/assets/style.csl

@dhimmel
Copy link
Member

dhimmel commented Nov 3, 2022

Noting the underlying issue tomduck/pandoc-eqnos#60. One alternative might be to manually number equations if switching to pandoc-crossref is problematic.

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

5 participants