I have LyX 2.3 installed, and my understanding is that LyX > 2.2 should have an option to export to *.docx out-of-the-box (e.g. "File > Export > MS Word Office Open XML"). But for me, that menu item is missing.
Interestingly, when I look in the "Preferences > File Handling > Converters" dialog, there is a converter for "LaTeX (plain) -> MS Word Office Open XML":
pandoc -s -f latex -o $$o -t docx $$i
If I have LyX export a *.tex file, and then use the above pandoc
command on that *.tex file, I get a successful conversion to *.docx. So I know that pandoc
is installed properly and that LyX is aware of it.
Also interestingly, if I add a new converter for "LaTeX (XeTeX) -> MS Word Office Open XML" with the exact same pandoc
command (so the only difference is that it's converting from "XeTeX-style" latex instead of "plain" latex), the expected export menu item appears. The exported document has "@/path/to/directory/containing/lyx/file" on the first line (which wasn't present when I manually ran pandoc
on the command line), but looks otherwise correct.
I also tried adding a "LyX -> LaTeX (plain)" converter (since there wasn't one to begin with) with the idea that maybe LyX just didn't know how to convert to LaTeX (plain) for some reason, but that had no effect.
So my question is: can anyone explain how to get LyX to recognize plain LaTex exporters? It's not a dire problem, I have the XeTeX hack (even if it adds a weird header for some reason), and I can always run pandoc
from the command line. But it seems like something that should just work, no questions asked.
Edit:
Here are some relevant lines from my configure.log
file:
INFO: checking for a LaTeX -> RTF converter...
INFO: +checking for "latex2rtf"... yes
DEBUG: Add to RC:
\converter latex rtf "latex2rtf -p -S -o $$o $$i" "needaux"
INFO: checking for a LaTeX -> Open Document (Pandoc) converter...
INFO: +checking for "pandoc"... yes
DEBUG: Add to RC:
\converter latex odt3 "pandoc -s -f latex -o $$o -t odt $$i" ""
INFO: checking for a LaTeX -> MS Word Office Open XML converter...
INFO: +checking for "pandoc"... yes
DEBUG: Add to RC:
\converter latex word2 "pandoc -s -f latex -o $$o -t docx $$i" ""
INFO: +checking for "pandoc"... yes
@path
thing, that's because when LyX creates a temporary .tex file with the export to LaTeX (plain), it puts in it the LaTeX command\def\input@path{{/path/to/directory/containing/lyx/file}}
. I guess Pandoc decides to convert it to actual text. You might want to ask for an enhancement and explain that that command should not correspond to any output. I think that's a reasonable feature request for Pandoc, but I'm not sure.