gutenberg / latex-awesomebox

A package to draw attention boxes in your documents, illustrated with FontAwesome icons (Mirror)

Home Page:https://git.umaneti.net/latex-awesomebox/about/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is this only for PDF rendering? Paragraph is skipped when docx

cavo789 opened this issue · comments

First of all, my best wishes for 2020!

Is it possible that awesomebox isn't working at all when rendering to a .docx file?

Here is my markdown sample:

# test awesomebox

Paragraph 1

\notebox{Paragraph 2}

Paragraph 3

(file called index.md)

Paragraph 2 is rendered with a notebox style when pandoc is used to generate a PDF but totally forgotten when the output format is docx. (And this is very annoying since the real documentation is no more correct!)

For the pdf rendering, I'm using this command:

pandoc .\index.md -H .\awesomebox.tex --standalone --from=markdown --pdf-engine xelatex -o .\test.pdf 

Result is correct, as expected:

2020-01-02_08h36_44

For the docx rendering, here is my command:

pandoc .\index.md -H .\awesomebox.tex --standalone --from=markdown -t docx -o .\test.docx

Result is wrong, the paragraph 2 has disappear.

2020-01-02_08h37_49

If that's how it should work, it's really annoying since the really important paragraphs (such as warningbox or importantbox) contain information that should be in the generated documentation. As a result, I couldn't use awesomebox if I want to be able to generate anything other than pdf.

Thanks for any tips.

Hello

Do you have any tips please? I need to also convert documents to Word (since our Translation teams work with an external tool which only support .docx).

The current situation: if I use awesomebox tags in my markdown content; it's ok for PDF rendering but I loose the paragraph when exporting to DOCX which is thus a major issue.

If no solution can be found, I'll have no choice and will abandon your tool; unfortunately

Thanks

Hi @cavo789

You know some times people are off for various reasons and anyway, libre open-source software are developped only on spare time. Thus you cannot expect such a quick answer in less than a week.

To answer your issue, I think you try to achieve an impossible goal. My LaTeX library works with pandoc when converting from a markdown documents to a pdf because pandoc use LaTeX as an intermediary format to produce the final pdf file. In the contrary, pandoc generate directly docx files from markdown documents.

My library is solely expected to run with latex or xelatex document preparaton system. It won't works with any other systems. Thus yes, I'm afraid you'll be obliged to switch to another tool to have this kind of block in your docx document. You should focus only on the docx rendering, as it is easy to produce a pdf from a docx: that way you'll be sure your docx and pdf will have the same rendering. I'm absolutely not an expert of microsoft product, thus I can't help more than that.

Have a good day

Bonjour Étienne

Si tu as ressenti de l'agressivité dans mon message; je te prie de m'excuser; ce n'était pas l'intention ! Juste que j'ai besoin de savoir si je peux garder l'outil awesomebox ou pas.

Back to english for any other readers...

Ok, thanks for the explanation; I wasn't aware that pandoc was using latex before rendering in PDF and not when rendering to Word.

Damned! This is annoying... I was really happy to find after a very, very long trip on Google your tool. Because I need to be able to generate docx/pdf, I couldn't use it.

(for info, I'm also an Open Source developer with a lot of repos and I perfectly know that this is done and maintained by people on their free time; this is my case too).

Have a nice day.

Hello

Because it would be a real shame to do without Awesomebox, I developed a little work-around

So I've a markdown file with a content like (file source.md)

# test awesomebox

Paragraph 1

\notebox{Paragraph 2}

Paragraph 3

In a bash file, I make a copy of that file to f.i. temp.md.

When my generation isn't for a PDF file, so I need to remove awesomebox tags.

Such tag is like \importantbox{Ipso lorem} i.e.

  • A new paragraph
  • Starting by \
  • Followed by a word with box as the three last letters
  • Followed by {
  • Then a text (on one paragrah}
  • Followed by }
  • And a carriage return.

The regex is here below. The idea is to match the content and remove the tag.

sed will update the temp.md file, remove awesomebox tags and, now, I can use pandoc on temp.md to generate my Word document.

sed -i -E 's/^\\[a-z]*box\{(.*)\}$/\1/g' temp.md;

(a long story for a one line regex ;) )

Hope this can help someone.

Thanks Étienne for your tool.

Glad you find a solution for your problem :)