Open evan0greenup opened 5 years ago
There are mature toolchain in LyX to convert any TeX to LyX. However, it need a extra shell command. It could be in some extent not convenient. If add a few lines of code in Pandoc to integrate LyX in pandoc ecosystem. It would be benefit for both Pandoc and LyX.
My question is: do you need a LyX writer or reader? i.e. to do you want to do pandoc --to lyx
or pandoc --from lyx
?
It would be awesome if added Both reader and writer.
My impression (from talking to one of the LyX developers years ago) was that LyX had added some pandoc integration. I guess it's this: https://wiki.lyx.org/Tips/ExportingOpenDocumentLibreofficeOpenofficeAndOfficeOpenXMLMSWordWithPandoc
What you're looking for, I take it, is something more general: bidirectional conversion between lyx
and any pandoc-supported format.
Can you point to a specification of the LyX file format? I couldn't find one with a bit of searching.
Here's a sample LyX file (the default you get when you open LyX). We'd really need full documentation on this file format to read and write it reliably. And, if this were to go further, it would be good to get some LyX developers involved in the conversation.
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options false
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "palatino" "default"
\font_sans "helvet" "default"
\font_typewriter "courier" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 95 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures false
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 0
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Title
Welcome to \SpecialChar LyX
!
\end_layout
\begin_layout Section*
Most important things to know when using \SpecialChar LyX
\end_layout
\begin_layout Enumerate
\SpecialChar LyX
comes with excellent documentation — please use it! Start with the menu
\family sans
Help\SpecialChar menuseparator
Introduction
\family default
, which will give you a very brief introduction to the documentation.
Then learn about using \SpecialChar LyX
with
\family sans
Help\SpecialChar menuseparator
Tutorial
\family default
.
\end_layout
\begin_layout Enumerate
\SpecialChar LyX
is what we call a
\begin_inset Quotes eld
\end_inset
document processor.
\begin_inset Quotes erd
\end_inset
By design, it is different from regular word processors — in a way that
makes writing documents easier.
But only a little different, so don't be scared.
The documentation will make it all clear.
\end_layout
\begin_layout Enumerate
The output from \SpecialChar LyX
looks great! Use the menu
\family sans
Document\SpecialChar menuseparator
View
\begin_inset space ~
\end_inset
[PDF
\begin_inset space ~
\end_inset
(pdf\SpecialChar softhyphen
latex)]
\family default
or press the toolbar button
\begin_inset Info
type "icon"
arg "buffer-view"
\end_inset
now to see for yourself.
\end_layout
\begin_layout Enumerate
Yes, \SpecialChar LyX
can mimic (almost) all \SpecialChar LaTeX
functionality.
And yes, \SpecialChar LyX
can import \SpecialChar LaTeX
files.
Experienced \SpecialChar LaTeX
users should skim the rest of the
\emph on
Tutorial
\emph default
, then read the
\begin_inset Quotes eld
\end_inset
\SpecialChar LyX
for \SpecialChar LaTeX
Users
\begin_inset Quotes erd
\end_inset
chapter.
(Everyone else: don't worry, you don't need to know \SpecialChar LaTeX
to use \SpecialChar LyX
.)
\end_layout
\begin_layout Enumerate
\SpecialChar LyX
has lots of features for people who read or write a language other than
English.
In addition, the key bindings, toolbars, and many other characteristics
are highly configurable.
See
\family sans
Help\SpecialChar menuseparator
Customization
\family default
for details.
\end_layout
\begin_layout Enumerate
The \SpecialChar LyX
home page is
\begin_inset Flex URL
status collapsed
\begin_layout Plain Layout
https://www.lyx.org
\end_layout
\end_inset
.
Get information about \SpecialChar LyX
, subscribe to the \SpecialChar LyX
mailing list(s), take the \SpecialChar LyX
Graphical
Tour:
\begin_inset Flex URL
status collapsed
\begin_layout Plain Layout
https://www.lyx.org/Walkthrough
\end_layout
\end_inset
, and more.
\end_layout
\begin_layout Enumerate
\series bold
Note for Linux users:
\series default
Please check that the language packages for the \SpecialChar LaTeX
distribution
\family sans
\SpecialChar TeX
\begin_inset space ~
\end_inset
Live
\family default
are installed.
Otherwise you will get \SpecialChar LaTeX
errors.
\begin_inset Newline newline
\end_inset
For example on the Linux distributions
\family sans
(K,X)Ubuntu
\family default
and
\family sans
Debian
\family default
the package name for the German language is
\begin_inset Quotes eld
\end_inset
\family typewriter
texlive-lang-german
\family default
\begin_inset Quotes erd
\end_inset
.
\begin_inset Newline newline
\end_inset
After the installation of the language packages you must use the \SpecialChar LyX
menu
\family sans
Tools
\family default
\SpecialChar menuseparator
\family sans
Reconfigure
\family default
.
\end_layout
\end_body
\end_document
@jgm , If you can communicate with LyX developer, it would be fantastic. It means if the improvement is done on both side, pandoc would be more flexible and wide-supported and LyX would be able to involved in Pandoc ecosystem.
If it is possible you can let LyX developer provide some essential api for pandoc. It would also be great if these api can feedback more detailed error message (when the input is invalid).
Adding a couple of points:
The LyX team seems to be planning to turn their LyX format an XML format. It's probably wiser to wait until that's done.
Read/write the LyX format would provide us with an excellent visual pandoc's markdown editor, especially for academic writing. There are few options at the moment: few visual markdown editors handle pandoc's flavour of markdown. IMHO the best is currently RStudio's visual editor for markdown, which is built with the Prosemirror javascript library. One with an even better potential though is LyX:
All it would take to this would be for pandoc to be able to read and write LyX's own format.
For the LyX team, the ability to send their format through pandoc would greatly expand the range of formats they can target. At the moment it can only be used to write LaTeX, XHTML, Sweave and perhaps a few others. (Of course we can use it to write pandoc's markdown through LaTeX, but that is far from ideal.)
While it may help if LyX switched to an XML based format, the page you link was last edited 10 years ago. I am not sure there is any current plan to change the LyX format radically.
Lyx is a graphical WYSIWYM editor for TeX/LaTeX. But it has its own format
*.lyx
. It also provide tools to convert between latex and lyx. However, if pandoc bring a connection between latex and lyx (it could be reuse the tools in lyx package (add lyx as optional dependency)). Pandoc will be able to convert any format which is able to reach latex to lyx.It will bring a lot convenience.