-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Using a custom.docx breaks "Figure with Caption" Styling. #3656
Comments
Actually, it is not so simple to fix. Basically if you set w:styleId and w:val to |
Okay, we can change |
PS. Thanks for the excellent bug report! |
Well thanks multiplied for such an amazing tool! I agree that Writer Code to change: https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Writers/Docx.hs#L878 I'm happy to edit the reference.docx to change the stylename. I can edit the docx manually (rename to zip, edit files, rezip and rename). Or I can edit it via Word (V15.33 for macOS); but that will update to a later version of Word than the reference.docx was generated with — some of the XML meta headers also change and I don't want to trigger any potential gotchas... Can't wait for Pandoc 2.0, it's going to be an excellent release! |
Here is reference.docx edited manually to use w:styleId= |
Edit styles.xml as part of the fix for #3656
This is pretty simple. First create two custom docx reference templates:
Now edit customB.docx in Word — all you need to do is open it, add a space, delete the space and save. Now if you use this markdown and those templates:
You find in for resultB.docx in Word that the figure loses its "Figure with Caption" styling (and thus keep with next), and is now "Normal".
The reason is a case issue caused by Word editing the styles on save, here is styles.xml for A vs. B:
(LEFT==resultA.docx | RIGHT=resultB.docx) For some reason, Word overwrites the w:styleId = FigureWithCaption with the w:val extrapolation so the w:styleId becomes FigurewithCaption. But the document.xml still uses the uppercase version and thus fails to apply. The easiest fix I assume is to rename the original template so both w:val and w:styleId use an uppercase W. I couldn't see other styles that use mixed case in the pandoc template, but assume this applies to any such style.
The text was updated successfully, but these errors were encountered: