Re: How to export docx/odt

Richard Kimberly Heck via lyx-users <[email protected]> Sat, 7 Mar 2026 13:23:50 -0500
Newsgroups gmane.editors.lyx.general
Message-ID <[email protected]>
On 3/7/26 1:51 AM, Gunnar Lindholm via lyx-users wrote:
> How can I export with "Opendoc (Pandoc)"   and "MS Word Office Open 
> XML" formats from the command line?

PS My own preference is to export to LaTeX and then run pandoc from the 
command line myself. The reason is that I'd like to be able to use the 
bibliography processing that pandoc offers.

Below is the bash program latex2odt that I use for this, and a lyx2odt 
that calls it. Obviously, this is easily adapted to output other formats.

Riki

=====

#!/bin/bash

PANDOC=$(which pandoc);
if [ ! -e "$PANDOC" ]; then
     echo "Need pandoc installed!";
     exit 1;
fi

function printUsage {
     echo "latex2odt INFILE";
}

INFILE="$1";
if [ -z "$INFILE" ]; then
     printUsage;
     exit 1;
fi

OUTFILE="${INFILE%.tex}.odt";

BIBFILES="heck sexuality blogposts frege biblio";
BIBLIST="";
for bf in BIBFILES; do
     BIBLIST="--bilbiography=\"$bf\" $BIBLIST";
done

pandoc -s --resource-path="$BIBINPUTS" --citeproc $BLBLIST -t odt -o 
"$OUTFILE" -f latex "$INFILE";

=====

#!/bin/bash

function printUsage {
     echo "lyx2odt INFILE";
}

INFILE="$1";
if [ -z "$INFILE" ]; then
     printUsage;
     exit 1;
fi

TEXFILE="${INFILE%.lyx}.tex";

lyx -e latex $INFILE || exit 1;
latex2odt "$TEXFILE";

-- 
lyx-users mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-users