Intermediate .tex file during 'Convert' differs from manual export, causes problems

Alexander lyx at jalsti.de
Thu Jun 11 09:50:39 UTC 2020


Hi all,

during creation of a Markdown converter in LyX I noticed some behavior,
which messes up the final output.

- created a new File Format 'Markdown' (as 'Document format' and 'With
  TeX fonts:' = 'PDF (XeTex)' <-- side note: using 'PDF (pdflatex)'
  would result in UTF-8 encoding errors during later conversion with
  pandoc error "pandoc: Cannot decode byte…")

- created a new Converter Definition 'LaTeX (XeTeX) -> Markdown', with
  converter command 'pandoc --wrap=none -f latex -t markdown -o $$o $$i'
  (results below are also the same when using 'LaTeX (plain) ->
  Markdown' as Converter)

- used this converter to export as Markdown


This basically works, and when I have an algorithm included in the LyX
file, the export still finishes, but has a fault in the output.

The intermediate .tex temp file created by LyX, during exporting to
markdown, has the two lines
--
\begin{lstlisting}%
[language=Python]
--
which in the final markdown file look like
--
    %
    [language=Python]
--
This causes problems when people receiving the Markdown file then try
to convert them to PDF, as the code is like that not correctly rendered
as program code.

When manually exporting the .lyx as 'PDF (XeTex)' the resulting file
does not have the problem, the output is one line
--
\begin{lstlisting}[language=Python]
--
which in the markdown file (generated using same command as in my new
LyX Converter: "pandoc --wrap=none -f latex -t markdown -o
"minimal-example.md" "minimal-example.tex") results in the correct
output, which gets handled as code:
--
``` {.python language="Python"}
--

This is Lyx 2.3.2 on Debian Linux and I would be happy if someone could
tell me how to get this generator running with the expected output of
algorithms.
[Attached example files, hoping the file names are self-explanatory]

TYVM,
Alexander

-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-example.lyx
Type: application/x-lyx
Size: 2656 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200611/08f897cb/attachment-0001.lyx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-example--by-lyx.md
Type: text/markdown
Size: 165 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200611/08f897cb/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-example--by-lyx.md.pdf
Type: application/pdf
Size: 13215 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200611/08f897cb/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-example--by-pandoc.md
Type: text/markdown
Size: 153 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200611/08f897cb/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-example--by-pandoc.md.pdf
Type: application/pdf
Size: 14690 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200611/08f897cb/attachment-0003.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-example--by-xetex.tex
Type: text/x-tex
Size: 1472 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200611/08f897cb/attachment-0002.tex>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minimal-example--lyx-tempfile.tex
Type: text/x-tex
Size: 1411 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200611/08f897cb/attachment-0003.tex>


More information about the lyx-users mailing list