RE: Intermediate .tex file during 'Convert' differs from manual export,causes problems
Alex Could you please explain to me in simple English what these files represent. How do they relate to my problem. Mike Sent from Mail for Windows 10 From: Alexander Sent: 11 June 2020 11:10 To: lyx-users@lists.lyx.org Subject: Intermediate .tex file during 'Convert' differs from manual export,causes problems 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 -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Intermediate .tex file during 'Convert' differs from manual export,causes problems
Hi Mike, I am sorry if you misunderstood something. These files are only related to my problem I described below and which got solved by Jürgens suggestions. I do not know anything about any problems you might have posted to the public lyx-user list. Sorry again, Best, Alexander Mike Reeks am Donnerstag, 11. Juni 2020, 21:12:17: > Alex > Could you please explain to me in simple English what these files > represent. How do they relate to my problem. Mike > > Sent from Mail for Windows 10 > > From: Alexander > Sent: 11 June 2020 11:10 > To: lyx-users@lists.lyx.org > Subject: Intermediate .tex file during 'Convert' differs from manual > export,causes problems > > 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 > > Vielen Dank und Grüße, Alexander Stiebing -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Intermediate .tex file during 'Convert' differs from manual export, causes problems
On Thu, Jun 11, 2020 at 05:43:42PM +0200, Alexander wrote: > Hi Jürgen, > > On Thu, 11 Jun 2020 14:13:34 +0200 > Jürgen Spitzmüller wrote: > > > The reason for the difference is this commit: > > commit e798db5739871aaa29f95de321c52f19058064c9 > > (…) > > The converter flag "nice" will get you the LaTeX file which is also > > used for export. > > This is the even-greater-than-I-could-hope-for answer I could not > even hope for :-) > > Adding 'nice' as flag for the converter solves the case (and the > question marks in my head) – thank you very much for your effort. That's great the problem seems to be solved. Alexander, would you mind still filing a bug/enhancement report for Pandoc? Even though the issue doesn't affect you anymore, it would affect others. I suggest to make a minimal example .tex file and to post it here: https://github.com/jgm/pandoc/issues Let us know what issue number is so we can follow the discussion. Thanks! Scott signature.asc Description: PGP signature -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Intermediate .tex file during 'Convert' differs from manual export, causes problems
Hi Jürgen, On Thu, 11 Jun 2020 14:13:34 +0200 Jürgen Spitzmüller wrote: > The reason for the difference is this commit: > commit e798db5739871aaa29f95de321c52f19058064c9 > (…) > The converter flag "nice" will get you the LaTeX file which is also > used for export. This is the even-greater-than-I-could-hope-for answer I could not even hope for :-) Adding 'nice' as flag for the converter solves the case (and the question marks in my head) – thank you very much for your effort. Best, Alexander -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Intermediate .tex file during 'Convert' differs from manual export, causes problems
Am Donnerstag, den 11.06.2020, 12:59 +0200 schrieb Alexander: > Thx for first suggestions, but isn't the real point, that LyX does > different .tex exports, depending on if it is an intermediate > temporary file, or manually done? > > Shouldn't it be always the same, or shouldn't there at least be a > possibility to force the one or other option? The reason for the difference is this commit: commit e798db5739871aaa29f95de321c52f19058064c9 Author: Guillaume Munch , Mon Oct 10 16:52:32 2016 +0200 (vor 3 Jahren, und 8 Monaten) Committer: Guillaume Munch , Sat Oct 22 22:39:33 2016 +0200 (vor 3 Jahren, und 8 Monaten) Follows: 2.2.0 Precedes: 2.3.0alpha1 Branches: Safe line break to increase precision of error reporting in Listings caption So apparently the %\n improves error messages in Listings (which are only relevant to batch export). > If I only new at least which kind of .tex export mode LyX uses for > intermediate files, I would at least know where to try more tuning of > its behavior. The converter flag "nice" will get you the LaTeX file which is also used for export. HTH, Jürgen signature.asc Description: This is a digitally signed message part -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Intermediate .tex file during 'Convert' differs from manual export, causes problems
Am Donnerstag, den 11.06.2020, 12:59 +0200 schrieb Alexander: > Working around (IMHO) weird LyX behavior with additional scripts does > not really sound like the way to achieve the normal result, in my > view… > > If I only new at least which kind of .tex export mode LyX uses for > > intermediate files, I would at least know where to try more tuning of > > its behavior. The files are semantically equivalent. The output is not weird at all. It's pandoc that does not get this right. Jürgen signature.asc Description: This is a digitally signed message part -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Intermediate .tex file during 'Convert' differs from manual export, causes problems
Hi, On Thu, 11 Jun 2020 12:30:19 +0200 Jean-Marc Lasgouttes wrote: > Le 11/06/2020 à 12:28, Jürgen Spitzmüller a écrit : > > Am Donnerstag, den 11.06.2020, 11:50 +0200 schrieb Alexander: > >> 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] > > > > Since this is perfectly valid LaTeX it strikes me a pandoc bug. I > > suggest you file a report at https://github.com/jgm/pandoc/issues > > > > As for the export, you could add an intermediate script that > > transfers > > > > }% > > [ > > > > to > > > > }[ > > Or maybe even remove traces of "%\n" ? > > JMarc > Thx for first suggestions, but isn't the real point, that LyX does different .tex exports, depending on if it is an intermediate temporary file, or manually done? Shouldn't it be always the same, or shouldn't there at least be a possibility to force the one or other option? Working around (IMHO) weird LyX behavior with additional scripts does not really sound like the way to achieve the normal result, in my view… If I only new at least which kind of .tex export mode LyX uses for intermediate files, I would at least know where to try more tuning of its behavior. Alexander -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Intermediate .tex file during 'Convert' differs from manual export, causes problems
Le 11/06/2020 à 12:28, Jürgen Spitzmüller a écrit : Am Donnerstag, den 11.06.2020, 11:50 +0200 schrieb Alexander: 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] Since this is perfectly valid LaTeX it strikes me a pandoc bug. I suggest you file a report at https://github.com/jgm/pandoc/issues As for the export, you could add an intermediate script that transfers }% [ to }[ Or maybe even remove traces of "%\n" ? JMarc -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Intermediate .tex file during 'Convert' differs from manual export, causes problems
Am Donnerstag, den 11.06.2020, 11:50 +0200 schrieb Alexander: > 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] Since this is perfectly valid LaTeX it strikes me a pandoc bug. I suggest you file a report at https://github.com/jgm/pandoc/issues As for the export, you could add an intermediate script that transfers }% [ to }[ HTH Jürgen signature.asc Description: This is a digitally signed message part -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Intermediate .tex file during 'Convert' differs from manual export, causes problems
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 minimal-example.lyx Description: application/lyx Minimal example % [language=Python] @my_decorator(foo, bar=baz) def dummy(arg): arr = arg out = pack.method(arr) return out minimal-example--by-lyx.md.pdf Description: Adobe PDF document Minimal example ``` {.python language="Python"} @my_decorator(foo, bar=baz) def dummy(arg): arr = arg out = pack.method(arr) return out ``` minimal-example--by-pandoc.md.pdf Description: Adobe PDF document %% LyX 2.3.2 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. \documentclass[10pt,american,ngerman]{article} \usepackage{lmodern} \usepackage[T1]{fontenc} \usepackage[a4paper]{geometry} \geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=1.5cm,rmargin=1.5cm} \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0pt} \usepackage{babel} \usepackage{float} \usepackage[unicode=true, bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, breaklinks=true,pdfborder={0 0 0},pdfborderstyle={},backref=page,colorlinks=false] {hyperref} \makeatletter %% LyX specific LaTeX commands. \floatstyle{ruled} \newfloat{algorithm}{tbp}{loa} \providecommand{\algorithmname}{Algorithmus} \floatname{algorithm}{\protect\algorithmname} \makeatother \usepackage{listings} \addto\captionsamerican{\renewcommand{\algorithmname}{Algorithm}} \addto\captionsamerican{\renewcommand{\lstlistingname}{Listing}} \addto\captionsngerman{\renewcommand{\algorithmname}{Algorithmus}} \addto\captionsngerman{\renewcommand{\lstlistingname}{Listing}} \renewcommand{\lstlistingname}{Listing} \begin{document} Minimal example \selectlanguage{american}% \begin{algorithm}[h] \begin{lstlisting}[language=Python] @my_decorator(foo, bar=baz) def dummy(arg): arr = arg out = pack.method(arr) return out \end{lstlisting} \end{algorithm} \selectlanguage{ngerman}% \end{document} \batchmode \makeatletter \def\input@path{{/dev/shm/}} \makeatother \documentclass[10pt,american,ngerman]{article} \usepackage{lmodern} \usepackage[T1]{fontenc} \usepackage[a4paper]{geometry} \geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=1.5cm,rmargin=1.5cm} \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0pt} \usepackage{babel} \usepackage{float} \usepackage[unicode=true, bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=2, breaklinks=true,pdfborder={0 0 0},pdfborderstyle={},backref=page,colorlinks=false] {hyperref} \makeatletter %% LyX specific LaTeX commands. \floatstyle{ruled} \newfloat{algorithm}{tbp}{loa} \providecommand{\algorithmname}{Algorithmus} \floatname{algorithm}{\protect\algorithmname} \makeatother \usepackage{listings} \addto\captionsamerican{\renewcommand{\algorithmname}{Algorithm}} \addto\captionsamerican{\renewcommand{\lstlistingname}{Listing}} \addto\captionsngerman{\renewcommand{\algorithmname}{Algorithmus}} \addto\captionsngerman{\renewcommand{\lstlistingname}{Listing}} \renewcommand{\lstlistingname}{Listing} \begin{document} Minimal example \selectlanguage{american}%