commit 72b43fe46676a836c0318e681c33f5a3b16badeb
Author: Juergen Spitzmueller <[email protected]>
Date: Thu Aug 27 07:25:16 2026 +0200
LyX-Code is dead, long live Code (#12440)
The new layout employs the alltt environment from the package of the
same name (LaTeX core) which is more robust and reliable than our own
humble attempt.
There are some design differences, though; hence old documents retain
their LyX-Code paragraph (with LyX-Code being defined in a local layout).
File format change.
---
development/FORMAT | 4 +
lib/RELEASE-NOTES | 7 +-
lib/doc/UserGuide.lyx | 286 ++++++++++++++++++++++++++++++++++-------
lib/doc/de/UserGuide.lyx | 300 ++++++++++++-------------------------------
lib/layouts/AEA.layout | 2 +-
lib/layouts/beamer.layout | 59 ++++-----
lib/layouts/ltx-talk.layout | 57 ++++----
lib/layouts/lyxmacros.inc | 36 ++----
lib/layouts/revtex4-x.inc | 2 +-
lib/lyx2lyx/lyx_2_6.py | 79 +++++++++++-
src/Paragraph.cpp | 14 +-
src/mathed/InsetMathHull.cpp | 10 +-
src/mathed/InsetMathNest.cpp | 2 +
src/mathed/MathStream.h | 6 +
src/output_latex.cpp | 12 +-
src/tex2lyx/Preamble.cpp | 5 +-
src/version.h | 4 +-
17 files changed, 511 insertions(+), 374 deletions(-)
diff --git a/development/FORMAT b/development/FORMAT
index a798d73330..893d24c7aa 100644
--- a/development/FORMAT
+++ b/development/FORMAT
@@ -7,6 +7,10 @@ changes happened in particular if possible. A good example
would be
-----------------------
+2026-08-25 Jürgen Spitzmüller <[email protected]>
+ * Format incremented to 660: Ditch LyX-Code and add Code (alltt)
instead.
+ Old layouts are retained via local layout.
+
2026-08-03 Jürgen Spitzmüller <[email protected]>
* Format incremented to 659: Add new option
\html_math_output 5
diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index be97d152fd..14b83d15f1 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -71,7 +71,7 @@
LyX to copy the selection in a special representation to the external
clipboard.
Supported values are "latex", "docbook", and "xhtml", as well as "plain"
which
is equal to the default (copy as plain text string).
-
+
- The function paste now has a second optional argument "force" that will
enforce
conversion with the first argument "latex" or "html" even if the pasted
string
comes from the internal clipboard.
@@ -85,6 +85,11 @@
!!!The following layout-related changes has been done in 2.6 development cycle:
+- The layout "LyX-Code" (used by most document classes) has been replaced by a
new
+ layout, "Code". This employs the established alltt package and environment
rather
+ than rolling an own (rather deficient) definition. Since the output of the
old
+ and new layout is not identical, old documents will retain the LyX-Code
layout
+ as a local layout (see Document > Settings > Local Layout).
!!!The following LyX documents have been moved in 2.6:
diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx
index f0df18b910..30440cde1b 100644
--- a/lib/doc/UserGuide.lyx
+++ b/lib/doc/UserGuide.lyx
@@ -1,5 +1,5 @@
-#LyX 2.5 created this file. For more info see https://www.lyx.org/
-\lyxformat 643
+#LyX 2.6 created this file. For more info see https://www.lyx.org/
+\lyxformat 660
\begin_document
\begin_header
\save_transient_properties true
@@ -118,6 +118,7 @@ logicalmkup
\pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue,
filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ,
plainpages=false"
\papersize default
\use_geometry false
+\use_package aligned-overset 0
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
@@ -161,12 +162,13 @@ logicalmkup
\end_branch
\index Index
\shortcut idx
-\color #008000
+\color #ff008000
\end_index
\secnumdepth 3
\tocdepth 2
\paragraph_separation skip
\defskip halfline
+\parfillskip "default" ""
\is_math_indent 0
\math_numbering_side default
\quotes_style english
@@ -9443,23 +9445,42 @@ Special Environments
\end_layout
\begin_layout Subsubsection
+
+\change_deleted -712698321 1787652013
\SpecialChar LyX
\family sans
--Code
+-
+\change_unchanged
+Code
\begin_inset Index idx
range none
pageformat default
-status collapsed
+status open
\begin_layout Plain Layout
+
+\change_deleted -712698321 1787652005
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\end_layout
\end_inset
+\change_inserted -712698321 1787652010
+
+\begin_inset CommandInset label
+LatexCommand label
+name "subsec:Code"
+
+\end_inset
+
+
+\change_deleted -712698321 1787652010
+
\begin_inset CommandInset label
LatexCommand label
name "subsec:LyX-Code"
@@ -9467,18 +9488,30 @@ name "subsec:LyX-Code"
\end_inset
+\change_unchanged
+
\end_layout
\begin_layout Standard
The
+\change_deleted -712698321 1787652015
+
\family sans
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\family default
- environment is a \SpecialChar LyX
+ environment
+\change_deleted -712698321 1787652026
+is a \SpecialChar LyX
extension.
- It type-sets text in a typewriter-style font.
- It also treats the
+ It
+\change_unchanged
+type-sets text in a typewriter-style font.
+
+\change_deleted -712698321 1787652085
+It also treats the
\family sans
Space
\family default
@@ -9488,9 +9521,13 @@ status collapsed
\begin_layout Plain Layout
In the
+\change_deleted -712698321 1787652037
+
\family sans
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\family default
environment,
the
@@ -9510,10 +9547,16 @@ Space
\end_inset
+
+\change_unchanged
+\change_deleted -712698321 1787652062
+
\family sans
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\family default
,
@@ -9524,10 +9567,22 @@ Verbatim
\family sans
Verbatim
\family default
-* are the only environments in which you can type multiple whitespaces in
\SpecialChar LyX
+* are the only environments in which you can type multiple
+\change_deleted -712698321 1787652074
+whitespaces
+\change_inserted -712698321 1787652075
+blanks
+\change_unchanged
+ in \SpecialChar LyX
.
- If you need to insert blank lines,
- you will still need to use
+
+\change_deleted -712698321 1787740463
+If you need to insert blank lines,
+ you will still need to use
+\change_inserted -712698321 1787740465
+Both
+\change_unchanged
+
\begin_inset Info
type "shortcut"
arg "newline-insert newline"
@@ -9537,14 +9592,49 @@ arg "newline-insert newline"
\family typewriter
break-line
\family default
- function).
+ function)
+\change_inserted -712698321 1787740475
+ and
+\change_deleted -712698321 1787740477
+.
+
+\change_unchanged
\family sans
Return
\family default
- breaks paragraphs.
- Note,
+ break
+\change_deleted -712698321 1787740481
+s
+\change_unchanged
+
+\change_inserted -712698321 1787740492
+lines
+\change_deleted -712698321 1787740509
+paragraphs
+\change_unchanged
+.
+
+\change_inserted -712698321 1787740579
+You can enter (multiple) blank lines just by pressing
+\family sans
+Return
+\family default
+ (but not
+\begin_inset Info
+type "shortcut"
+arg "newline-insert newline"
+\end_inset
+
+) repeatedly.
+
+\change_unchanged
+Note
+\change_deleted -712698321 1787740547
+,
however,
+
+\change_unchanged
that
\family sans
Return
@@ -9552,26 +9642,43 @@ Return
does not reset the paragraph environment.
So,
when you finish using the
+\change_deleted -712698321 1787652102
+
\family sans
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\family default
environment,
you will need to change the paragraph environment yourself.
Also,
you can nest the
+\change_deleted -712698321 1787652110
+
\family sans
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\family default
environment inside of others.
\end_layout
\begin_layout Standard
+
+\change_deleted -712698321 1787740744
There are a few quirks with this environment:
+\change_inserted -712698321 1787740747
+Note also:
+
+\change_deleted -712698321 1787740750
+
\end_layout
\begin_layout Itemize
+
+\change_deleted -712698321 1787740750
You cannot use
\begin_inset Info
type "shortcut"
@@ -9600,6 +9707,8 @@ arg "newline-insert newline"
\end_layout
\begin_layout Itemize
+
+\change_deleted -712698321 1787740750
You cannot follow a
\begin_inset Info
type "shortcut"
@@ -9620,6 +9729,8 @@ arg "command-alternatives math-space ; space-insert
protected"
\end_layout
\begin_layout Itemize
+
+\change_deleted -712698321 1787740750
You cannot have an empty paragraph or an empty line.
You must put at least one
\family sans
@@ -9644,7 +9755,7 @@ real
You get the typewriter double quotes with
\begin_inset Info
type "shortcut"
-arg "self-insert \""
+arg "quote-insert outer auto plain"
\end_inset
.
@@ -9654,29 +9765,35 @@ arg "self-insert \""
Here is an example:
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
#include <stdio.h>
+\change_inserted -712698321 1787660179
+
+\end_layout
+
+\begin_layout Code
+
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
int main(void)
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
{
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
printf("Hello World!
\backslash
n");
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
return 0;
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
}
\end_layout
@@ -9694,9 +9811,13 @@ Hello world!
\begin_layout Standard
+\change_deleted -712698321 1787652466
+
\family sans
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\family default
has one purpose:
to typeset code,
@@ -9754,11 +9875,17 @@ The
Verbatim
\family default
environment is similar to the
+\change_deleted -712698321 1787656295
+
\family sans
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\family default
- environment with the difference that its content will be treated like a
computer console text.
+ environment with the difference that
+\change_deleted -712698321 1787660542
+its content will be treated like a computer console text.
\family sans
Verbatim
@@ -9777,11 +9904,40 @@ Return
\family sans
Space
\family default
- key is treated like a normal space in text (not as a non-breaking space) and
you can have empty lines.
- In contrary to
+ key is treated like a normal space in text (not as a non-breaking space) and
you can have empty lines
+\change_inserted -712698321 1787660648
+every \SpecialChar LaTeX
+ output will be output
+\emph on
+verbatim
+\emph default
+ (as the name says),
+ i.
+\begin_inset space \thinspace{}
+\end_inset
+
+e.,
+ as code,
+ not in its processed form
+\change_unchanged
+.
+
+\change_inserted -712698321 1787660654
+Hence,
+
+\change_deleted -712698321 1787660655
+I
+\change_inserted -712698321 1787660655
+i
+\change_unchanged
+n contrary to
+\change_deleted -712698321 1787660876
+
\family sans
\SpecialChar LyX
--Code,
+-
+\change_unchanged
+Code,
\family default
@@ -9793,6 +9949,10 @@ Verbatim
\begin_layout Itemize
have a certain language and a text style
+\change_inserted -712698321 1787660661
+ or
+\change_unchanged
+
\end_layout
\begin_layout Itemize
@@ -9853,11 +10013,31 @@ Verbatim*
\family sans
Verbatim
\family default
- with the difference that spaces appear in the output as the character '
+ with the difference that spaces appear in the output as the character
+\change_inserted -712698321 1787660685
+
+\begin_inset Quotes els
+\end_inset
+
+
+\change_deleted -712698321 1787660685
+'
+\change_unchanged
+
\begin_inset space \textvisiblespace{}
\end_inset
-'.
+
+\change_deleted -712698321 1787660687
+'
+\change_inserted -712698321 1787660700
+
+\begin_inset Quotes ers
+\end_inset
+
+
+\change_unchanged
+.
An example:
\end_layout
@@ -10155,9 +10335,13 @@ List
\begin_layout Itemize
+\change_deleted -712698321 1787661102
+
\family sans
\SpecialChar LyX
--Code
+-
+\change_unchanged
+Code
\end_layout
\begin_layout Itemize
@@ -11261,13 +11445,17 @@ Example 2:
Inheritance
\end_layout
-\begin_layout LyX-Code
-This is the LyX-Code environment,
+\begin_layout Code
+This is the
+\change_deleted -712698321 1787653584
+LyX-
+\change_unchanged
+Code environment,
at level #1,
the outermost
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
level.
Now we will enter
\family sans
@@ -11309,8 +11497,12 @@ Notice how the nested
Enumerate
\family default
not only inherits its margins from its parent environment (
+\change_deleted -712698321 1787661108
+
\family sans
-LyX-Code
+LyX-
+\change_unchanged
+Code
\family default
),
but also inherits its font and spacing!
@@ -33372,7 +33564,7 @@ LaTeX
:
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
\backslash
urlstyle{<xx>}
@@ -33407,7 +33599,7 @@ same
use this instead:
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
\backslash
def
@@ -33424,7 +33616,7 @@ URLs will break between lines at certain characters,
namely:
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
.
@
\backslash
@@ -39941,7 +40133,7 @@ literal "true"
\end_layout
\begin_layout Standard
-\begin_inset Newpage clearpage
+\begin_inset Textbreak clearpage
\end_inset
@@ -41031,7 +41223,7 @@ literal "true"
\end_layout
\begin_layout Standard
-\begin_inset Newpage clearpage
+\begin_inset Textbreak clearpage
\end_inset
@@ -58660,7 +58852,7 @@ textwidth
\end_layout
\begin_layout Standard
-\begin_inset Newpage newpage
+\begin_inset Textbreak newpage
\end_inset
The bibliography on the following page was created with the
@@ -60051,7 +60243,7 @@ https://wiki.lyx.org/Windows/Japanese
\end_layout
\begin_layout Standard
-\begin_inset Newpage newpage
+\begin_inset Textbreak newpage
\end_inset
diff --git a/lib/doc/de/UserGuide.lyx b/lib/doc/de/UserGuide.lyx
index cec1b1f168..8f729444ee 100644
--- a/lib/doc/de/UserGuide.lyx
+++ b/lib/doc/de/UserGuide.lyx
@@ -1,5 +1,5 @@
-#LyX 2.5 created this file. For more info see https://www.lyx.org/
-\lyxformat 643
+#LyX 2.6 created this file. For more info see https://www.lyx.org/
+\lyxformat 660
\begin_document
\begin_header
\save_transient_properties true
@@ -125,6 +125,7 @@ logicalmkup
\pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue,
filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ,
plainpages=false"
\papersize default
\use_geometry false
+\use_package aligned-overset 0
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
@@ -168,12 +169,13 @@ logicalmkup
\end_branch
\index Stichwortverzeichnis
\shortcut idx
-\color #008000
+\color #ff008000
\end_index
\secnumdepth 3
\tocdepth 2
\paragraph_separation skip
\defskip halfline
+\parfillskip "default" ""
\is_math_indent 0
\math_numbering_side default
\quotes_style german
@@ -9075,19 +9077,14 @@ Besondere Umgebungen
\end_layout
\begin_layout Subsubsection
-
-\family sans
-L
-\family default
-yX-Code
+Code
\begin_inset Index idx
range none
pageformat default
-status collapsed
+status open
\begin_layout Plain Layout
-\SpecialChar LyX
--Code
+Code
\end_layout
\end_inset
@@ -9095,7 +9092,7 @@ status collapsed
\begin_inset CommandInset label
LatexCommand label
-name "subsec:LyX-Code"
+name "subsec:Code"
\end_inset
@@ -9105,43 +9102,12 @@ name "subsec:LyX-Code"
\begin_layout Standard
Die
\family sans
-\SpecialChar LyX
--Code
-\family default
--Umgebung ist noch eine \SpecialChar LyX
--Erweiterung von \SpecialChar LaTeX
-.
- Sie setzt Text in einem Schreibmaschinenschriftart und behandelt
-\family sans
-Leertaste
-\family default
- wie ein festes Leerzeichen.
-\begin_inset Foot
-status collapsed
-
-\begin_layout Plain Layout
-In der
-\family sans
-\SpecialChar LyX
-
-\family default
--
-\family sans
Code
\family default
--Umgebung wird die Leertaste als geschütztes Leerzeichen behandelt anstatt als
-\family typewriter
-End-of-word
-\family default
--Markierung.
-\end_layout
-
-\end_inset
-
+-Umgebung setzt Text in einem Schreibmaschinenschriftart.
\family sans
-\SpecialChar LyX
--Code
+Code
\family default
,
@@ -9153,17 +9119,25 @@ und
Unformatiert
\family default
* sind die einzigen Umgebungen in denen die Leertaste mehrfach hintereinander
benutzt werden kann.
- Für Leerzeilen muss man
+ Sowohl
\family sans
Strg+Eingabe
\family default
- eingeben (die Zeilenumbruch-Funktion).
-
+ (die Zeilenumbruch-Funktion) als auch
\family sans
Eingabe
\family default
- beendet Absätze.
- Beachten Sie aber,
+ bewirken einfache Zeilenumbrüche.
+ Leere Zeilen können Sie durch wiederholtes Drücken von
+\family sans
+Eingabe
+\family default
+ (nicht jedoch
+\family sans
+Strg+Eingabe
+\family default
+) erhalten.
+ Beachten Sie,
dass
\family sans
Eingabe
@@ -9175,78 +9149,31 @@ nicht
die Absatzumgebung zurücksetzt.
Wenn man also die
\family sans
-\SpecialChar LyX
--Code
+Code
\family default
-Umgebung verlassen will,
muss man das durch Wahl einer anderen Umgebung machen.
\family sans
-\SpecialChar LyX
--Code
+Code
\family default
-Umgebungen kann man auch in andere schachteln.
\end_layout
\begin_layout Standard
-Diese Umgebung hat ein paar Besonderheiten:
-\end_layout
-
-\begin_layout Itemize
-Am Anfang eines neuen Absatzes kann man
-\family sans
-Strg+Eingabe
-\family default
- nicht benutzen (das heißt auf
-\family sans
-Eingabe
-\family default
- kann kein
-\family sans
-Strg+Eingabe
-\family default
- folgen).
-\end_layout
-
-\begin_layout Itemize
-Auf
-\family sans
-Strg+Eingabe
-\family default
- kann keine
-\family sans
-Leertaste
-\family default
- folgen,
- aber
-\family sans
-Strg+Leertaste
-\family default
-.
-\end_layout
-
-\begin_layout Itemize
-In der Druckausgabe gibt es keine leeren Absätze und keine leeren Zeilen.
- Sie müssen in jeder leeren Zeile mindestens einmal die Leertaste drücken.
-\end_layout
-
-\begin_layout Itemize
-Ein Schreibmaschinen-Anführungszeichen erreichen Sie nicht durch Eingabe von
+Beachten Sie auch:
+ Ein Schreibmaschinen-Anführungszeichen erreichen Sie nicht durch Eingabe von
\family sans
",
\family default
- weil das ein reales Anführungszeichen erzeugt.
- Sie erhalten es stattdessen über das Menü
-\family sans
-Einfügen\SpecialChar menuseparator
-Sonderzeichen\SpecialChar menuseparator
-Nicht-typographisches
-\begin_inset space ~
+ weil das ein typografisches Anführungszeichen erzeugt.
+ Sie erhalten es stattdessen über
+\begin_inset Info
+type "shortcut"
+arg "quote-insert outer auto plain"
\end_inset
-Anführungszeichen
-\family default
.
\end_layout
@@ -9254,33 +9181,33 @@ Anführungszeichen
Hier ist ein Beispiel:
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
#include<stdio.h>
\end_layout
-\begin_layout LyX-Code
-
+\begin_layout Code
+
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
int main(void)
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
{
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
printf("Hallo Welt!
\backslash
n");
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
return 0;
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
}
\end_layout
@@ -9299,8 +9226,7 @@ Hallo Welt!
\begin_layout Standard
\family sans
-\SpecialChar LyX
--Code
+Code
\family default
hat einen Zweck:
Code zu schreiben,
@@ -9377,47 +9303,33 @@ Die
\family sans
Unformatiert
\family default
- Umgebung ist ähnlich zur
+-Umgebung ist ähnlich zur
\family sans
-\SpecialChar LyX
--Code
+Code
\family default
- Umgebung,
+-Umgebung,
mit dem Unterschied,
- dass sein Inhalt wie ein Computer-Konsolentext behandelt wird.
-
-\family sans
-Unformatiert
-\family default
- hat daher keine Absätze so dass
-\family sans
-Eingabe
-\family default
- Zeilen umbricht.
- Verglichen mit
-\family sans
-\SpecialChar LyX
--Code
-\family default
- wird die
-\family sans
-Leertaste
-\family default
- wie ein normales Leerzeichen im Text behandelt (nicht als geschütztes
Leerzeichen) und man kann leere Zeilen haben.
+ dass jeglicher \SpecialChar LaTeX
+-Code wörtlich (eben
+\emph on
+unformatiert
+\emph default
+) ausgegeben wird,
+ also als Code,
+ nicht in prozessierter Form.
Im Gegensatz zu
\family sans
-\SpecialChar LyX
--Code
+Code
\family default
kann
\family sans
Unformatiert
\family default
- keine
+ daher keine
\end_layout
\begin_layout Itemize
-bestimmte Sprache und keinen Textstil haben
+bestimmte Sprache und keinen Textstil haben oder
\end_layout
\begin_layout Itemize
@@ -9479,11 +9391,19 @@ Unformatiert
\family default
,
mit dem Unterschied,
- dass Leerzeichen in der Ausgabe mit dem Zeichen '
+ dass Leerzeichen in der Ausgabe mit dem Zeichen
+\begin_inset Quotes gls
+\end_inset
+
+
\begin_inset space \textvisiblespace{}
\end_inset
-' angezeigt werden.
+
+\begin_inset Quotes grs
+\end_inset
+
+ angezeigt werden.
Ein Beispiel:
\end_layout
@@ -9879,8 +9799,7 @@ Liste
\begin_layout Itemize
\family sans
-\SpecialChar LyX
--Code
+Code
\end_layout
\begin_layout Itemize
@@ -10907,17 +10826,16 @@ Beispiel 2:
Vererbung
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
Dies ist die
\family sans
-\SpecialChar LyX
--Code
+Code
\family default
-Umgebung auf Stufe 1,
der äußersten Stufe.
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
Jetzt werden wir Eingabe drücken,
dann
\family sans
@@ -10931,7 +10849,7 @@ Alt+Eingabe+Rechts
werden wir zur
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
\family sans
Aufzählung
@@ -10939,7 +10857,6 @@ Aufzählung
-Umgebung wechseln.
\end_layout
-\begin_deeper
\begin_layout Enumerate
Dies ist die
\family sans
@@ -10948,6 +10865,7 @@ Aufzählung
-Umgebung auf Stufe 2.
\end_layout
+\begin_deeper
\begin_layout Enumerate
Sehen Sie,
wie die geschachtelte
@@ -10959,8 +10877,7 @@ ein\SpecialChar softhyphen
stel\SpecialChar softhyphen
lung der Elternumgebung (
\family sans
-\SpecialChar LyX
--Code
+Code
\family default
) erbt,
sondern auch Schriftart und Leerzeichen!
@@ -20191,61 +20108,6 @@ Objekte
Handbuchs beschrieben.
\end_layout
-\begin_layout Description
-Bemerkung:
- Wenn Sie manuelle Trennhilfen innerhalb einer
-\family sans
-LyX-Code
-\family default
--Umgebung benötigen,
- müssen Sie statt
-\family sans
-Strg+
-\family default
-
-\begin_inset space \thinspace{}
-\end_inset
-
--
-\begin_inset Flex Code
-status collapsed
-
-\begin_layout Plain Layout
-
-\backslash
--
-\end_layout
-
-\end_inset
-
- oder
-\begin_inset Flex Code
-status collapsed
-
-\begin_layout Plain Layout
-"-
-\end_layout
-
-\end_inset
-
- als \SpecialChar TeX
--Code benutzen,
- weil \SpecialChar LyX
- mit
-\family sans
-Strg+
-\family default
-
-\begin_inset space \thinspace{}
-\end_inset
-
-- in
-\family sans
-LyX-Code
-\family default
--Umgebungen (noch) nicht klarkommt.
-\end_layout
-
\begin_layout Subsubsection
Eigenheiten der deutschen Sprache
\end_layout
@@ -22185,7 +22047,7 @@ Natürlich kann \SpecialChar LyX
Wenn Schusterjungen trotzdem auftreten und Sie stören,
können Sie im \SpecialChar LaTeX
-Vorspann Ihres Dokuments die Befehle
-\begin_inset Newpage newpage
+\begin_inset Textbreak newpage
\end_inset
@@ -32504,7 +32366,7 @@ LaTeX
folgendes einfügen:
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
\backslash
urlstyle{<xx>}
@@ -32537,7 +32399,7 @@ same
Für kursive URLs verwenden Sie stattdessen dies:
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
\backslash
def
@@ -32554,7 +32416,7 @@ URLs werden am Zeilenende nur nach bestimmten Zeichen
umbrochen,
nämlich:
\end_layout
-\begin_layout LyX-Code
+\begin_layout Code
.
@
\backslash
@@ -39118,7 +38980,7 @@ name "subsec:DocBook-roh"
\end_layout
\begin_layout Standard
-\begin_inset Newpage clearpage
+\begin_inset Textbreak clearpage
\end_inset
@@ -40104,7 +39966,7 @@ literal "true"
\end_layout
\begin_layout Standard
-\begin_inset Newpage clearpage
+\begin_inset Textbreak clearpage
\end_inset
@@ -56952,7 +56814,7 @@ linewidth
\end_layout
\begin_layout Standard
-\begin_inset Newpage newpage
+\begin_inset Textbreak newpage
\end_inset
Das Literaturverzeichnis auf der folgenden Seite wurde mit einer
Literaturverzeichnis-Umgebung erzeugt.
@@ -58379,7 +58241,7 @@ https://wiki.lyx.org/Windows/Japanese
\end_layout
\begin_layout Standard
-\begin_inset Newpage newpage
+\begin_inset Textbreak newpage
\end_inset
diff --git a/lib/layouts/AEA.layout b/lib/layouts/AEA.layout
index dd3d50dc0b..07208a6bac 100644
--- a/lib/layouts/AEA.layout
+++ b/lib/layouts/AEA.layout
@@ -28,7 +28,7 @@ NoStyle Subsubsection*
NoStyle Paragraph*
NoStyle Subparagraph*
NoStyle List
-NoStyle LyX-Code
+NoStyle Code
NoStyle Verse
NoStyle Address
NoStyle Right_Address
diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index b30a25c671..0d301c5540 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -557,7 +557,7 @@ Style Frame
Standard,Itemize,Enumerate,Description,FrameTitle,FrameSubtitle,Column,
Columns,ColumnsCenterAligned,ColumnsTopAligned,Pause,Overprint,OverlayArea,Only,Block,
ExampleBlock,AlertBlock,Bibliography,Quotation,Quote,Verse,Corollary,Definition,Definitions,
- Example,Examples,Fact,Lemma,Proof,Theorem,LyX-Code
+ Example,Examples,Fact,Lemma,Proof,Theorem,Code
EndAutoNests
NeedCProtect -1
End
@@ -746,7 +746,7 @@ Style Columns
AutoNests
Standard,Column,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,Block,
ExampleBlock,AlertBlock,Bibliography,Quotation,Quote,Verse,Corollary,Definition,Definitions,
- Example,Examples,Fact,Lemma,Proof,Theorem,LyX-Code
+ Example,Examples,Fact,Lemma,Proof,Theorem,Code
EndAutoNests
End
@@ -982,7 +982,7 @@ Style Block
EndArgument
AutoNests
Standard,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,Quotation,
-
Quote,Verse,Corollary,Definition,Definitions,Example,Examples,Fact,Lemma,Proof,Theorem,LyX-Code
+
Quote,Verse,Corollary,Definition,Definitions,Example,Examples,Fact,Lemma,Proof,Theorem,Code
EndAutoNests
End
@@ -1351,7 +1351,7 @@ Style Corollary
Tooltip "Additional text appended to the theorem header"
EndArgument
AutoNests
-
Standard,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,LyX-Code
+
Standard,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,Code
EndAutoNests
End
@@ -1412,41 +1412,30 @@ End
# MISC.
#
-Style LyX-Code
- Category MainText
- Margin Static
- LatexType Environment
- LatexName lyxcode
- NextNoIndent 1
- LeftMargin MMM
- RightMargin MMM
- TopSep 0.5
- BottomSep 0.5
- Align Left
- AlignPossible Block, Left, Right, Center
- LabelType No_Label
- FreeSpacing 1
- Preamble
- \newenvironment{lyxcode}
- {\par\begin{list}{}{
- \setlength{\rightmargin}{\leftmargin}
- \setlength{\listparindent}{0pt}% needed for AMS classes
- \raggedright
- \setlength{\itemsep}{0pt}
- \setlength{\parsep}{0pt}
- \normalfont\ttfamily}%
- \def\{{\char`\{}
- \def\}{\char`\}}
- \def\textasciitilde{\char`\~}
- \item[]}
- {\end{list}}
- EndPreamble
+Style Code
+ Category MainText
+ Margin Static
+ LatexType Environment
+ LatexName alltt
+ NextNoIndent 1
+ TopSep 0.7
+ BottomSep 0.7
+ Align Left
+ AlignPossible Block, Left, Right, Center
+ LabelType No_Label
+ FreeSpacing 1
+ KeepEmpty 1
+ Newline 0
+ ParbreakIsNewline 1
+ PassThruChars " ~$"
+ Requires alltt
Font
- Family Typewriter
+ Family Typewriter
EndFont
DocBookTag programlisting
DocBookTagType paragraph
- DocBookAttr language='lyx'
+# FIXME: check this!
+ DocBookAttr language='lyx'
End
Style NoteItem
diff --git a/lib/layouts/ltx-talk.layout b/lib/layouts/ltx-talk.layout
index 3a8610c435..3b9ab85f81 100644
--- a/lib/layouts/ltx-talk.layout
+++ b/lib/layouts/ltx-talk.layout
@@ -541,7 +541,7 @@ Style Frame
AutoNests
Standard,Itemize,Enumerate,Description,FrameTitle,FrameSubtitle,Column,
Columns,ColumnsCenterAligned,ColumnsTopAligned,Pause,Overprint,OverlayArea,Only,Block,AlertBlock,ExampleBlock
- Bibliography,Quotation,Quote,Verse,LyX-Code
+ Bibliography,Quotation,Quote,Verse,Code
EndAutoNests
NeedCProtect -1
End
@@ -748,7 +748,7 @@ Style Columns
EndFont
AutoNests
Standard,Column,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,Block,AlertBlock,ExampleBlock,
- Bibliography,Quotation,Quote,Verse,LyX-Code
+ Bibliography,Quotation,Quote,Verse,Code
EndAutoNests
End
@@ -984,7 +984,7 @@ Style Block
EndArgument
AutoNests
Standard,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,Quotation,
- Quote,Verse,LyX-Code
+ Quote,Verse,Code
EndAutoNests
End
@@ -1327,41 +1327,30 @@ End
# MISC.
#
-Style LyX-Code
- Category MainText
- Margin Static
- LatexType Environment
- LatexName lyxcode
- NextNoIndent 1
- LeftMargin MMM
- RightMargin MMM
- TopSep 0.5
- BottomSep 0.5
- Align Left
- AlignPossible Block, Left, Right, Center
- LabelType No_Label
- FreeSpacing 1
- Preamble
- \newenvironment{lyxcode}
- {\par\begin{list}{}{
- \setlength{\rightmargin}{\leftmargin}
- \setlength{\listparindent}{0pt}% needed for AMS classes
- \raggedright
- \setlength{\itemsep}{0pt}
- \setlength{\parsep}{0pt}
- \normalfont\ttfamily}%
- \def\{{\char`\{}
- \def\}{\char`\}}
- \def\textasciitilde{\char`\~}
- \item[]}
- {\end{list}}
- EndPreamble
+Style Code
+ Category MainText
+ Margin Static
+ LatexType Environment
+ LatexName alltt
+ NextNoIndent 1
+ TopSep 0.7
+ BottomSep 0.7
+ Align Left
+ AlignPossible Block, Left, Right, Center
+ LabelType No_Label
+ FreeSpacing 1
+ KeepEmpty 1
+ Newline 0
+ ParbreakIsNewline 1
+ PassThruChars " ~$"
+ Requires alltt
Font
- Family Typewriter
+ Family Typewriter
EndFont
DocBookTag programlisting
DocBookTagType paragraph
- DocBookAttr language='lyx'
+# FIXME: check this!
+ DocBookAttr language='lyx'
End
Style NoteItem
diff --git a/lib/layouts/lyxmacros.inc b/lib/layouts/lyxmacros.inc
index ba1188f171..275688c141 100644
--- a/lib/layouts/lyxmacros.inc
+++ b/lib/layouts/lyxmacros.inc
@@ -9,41 +9,31 @@
Format 120
-Style LyX-Code
+
+Style Code
Category MainText
- Margin Static
LatexType Environment
- LatexName lyxcode
- NextNoIndent 1
- LeftMargin MMM
- RightMargin MMM
- TopSep 0.5
- BottomSep 0.5
+ LatexName alltt
+ TopSep 0.7
+ BottomSep 0.7
Align Left
AlignPossible Block, Left, Right, Center
LabelType No_Label
FreeSpacing 1
- Preamble
- \newenvironment{lyxcode}
- {\par\begin{list}{}{
- \setlength{\rightmargin}{\leftmargin}
- \setlength{\listparindent}{0pt}% needed for AMS
classes
- \raggedright
- \setlength{\itemsep}{0pt}
- \setlength{\parsep}{0pt}
- \normalfont\ttfamily}%
- \item[]}
- {\end{list}}
- EndPreamble
+ KeepEmpty 1
+ NewLine 0
+ ParbreakIsNewline 1
+ PassThruChars " ~$"
+ Requires alltt
Font
Family Typewriter
EndFont
DocBookTag programlisting
- DocBookTagType paragraph
- DocBookAttr language='lyx'
+ DocBookTagType paragraph
+# FIXME: check this!
+ DocBookAttr language='lyx'
End
-
Style Address
Category FrontMatter
Margin Static
diff --git a/lib/layouts/revtex4-x.inc b/lib/layouts/revtex4-x.inc
index 72ef719eaf..f96e0c1727 100644
--- a/lib/layouts/revtex4-x.inc
+++ b/lib/layouts/revtex4-x.inc
@@ -415,7 +415,7 @@ End
NoStyle Chapter
NoStyle Chapter*
-NoStyle LyX-Code
+NoStyle Code
NoStyle Right_Address
NoStyle Subparagraph
NoStyle Subparagraph*
diff --git a/lib/lyx2lyx/lyx_2_6.py b/lib/lyx2lyx/lyx_2_6.py
index 73c5c8b837..9cb38fae1e 100644
--- a/lib/lyx2lyx/lyx_2_6.py
+++ b/lib/lyx2lyx/lyx_2_6.py
@@ -61,6 +61,7 @@ from parser_tools import (
find_token,
find_token_backwards,
find_token_exact,
+ has_token,
get_bool_value,
get_containing_inset,
get_containing_layout,
@@ -1989,6 +1990,80 @@ def revert_mathjax(document):
if get_value(document.header, "\\html_math_output", i) == "5":
document.header[i] = "\\html_math_output 0"
+
+lyxcode_local_layout = [
+ "### Inserted by lyx2lyx (legacy LyX-Code) ###",
+ "Style LyX-Code",
+ " Category MainText",
+ " Margin Static",
+ " LatexType Environment",
+ " LatexName lyxcode",
+ " NextNoIndent 1",
+ " LeftMargin MMM",
+ " RightMargin MMM",
+ " TopSep 0.5",
+ " BottomSep 0.5",
+ " Align Left",
+ " AlignPossible Block, Left, Right, Center",
+ " LabelType No_Label",
+ " FreeSpacing 1",
+ " Preamble",
+ " \\newenvironment{lyxcode}",
+ " {\\par\\begin{list}{}{",
+ "
\\setlength{\\rightmargin}{\\leftmargin}",
+ " \\setlength{\\listparindent}{0pt}%
needed for AMS classes",
+ " \\raggedright",
+ " \\setlength{\\itemsep}{0pt}",
+ " \\setlength{\\parsep}{0pt}",
+ " \\normalfont\\ttfamily}%",
+ " \\item[]}",
+ " {\\end{list}}",
+ " EndPreamble",
+ " Font",
+ " Family Typewriter",
+ " EndFont",
+ " DocBookTag programlisting",
+ " DocBookTagType paragraph",
+ " DocBookAttr language='lyx'",
+ "End",
+ "### End of insertion by lyx2lyx (legacy LyX-Code) ###" "",
+]
+
+
+def convert_lyxcode(document):
+ """Convert LyX-Code to local layout"""
+
+ if has_token(document.body, "\\begin_layout LyX-Code", document.dir):
+ document.append_local_layout(lyxcode_local_layout)
+
+
+def revert_lyxcode(document):
+ """Revert LyX-Code local layout"""
+
+ i = find_token(document.body, "\\begin_layout LyX-Code", 0)
+ if i == -1:
+ return
+
+ document.del_local_layout(lyxcode_local_layout)
+
+
+def revert_alltt(document):
+ """Revert Code layout to LyX-Code"""
+
+ if document.textclass == "jss":
+ # this is a different Code
+ return
+
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_layout Code", i)
+ if i == -1:
+ return
+
+ # This is not ideal, but the closest we can get
+ document.body[i] = "\\begin_layout LyX-Code"
+
+
##
# Conversion hub
#
@@ -2010,11 +2085,13 @@ convert = [
[656, []],
[657, [convert_svmatters]],
[658, [convert_use_alignedoverset, convert_alignedoverset_body]],
- [659, []]
+ [659, []],
+ [660, [convert_lyxcode]]
]
revert = [
+ [659, [revert_alltt, revert_lyxcode]],
[658, [revert_mathjax]],
[657, [revert_use_alignedoverset]],
[656, [revert_matters]],
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 8f616a5008..cbb8c98377 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1018,7 +1018,10 @@ bool Paragraph::Private::simpleTeXBlanks(BufferParams
const & bparams,
os.texrow().start(owner_->id(), i + 1);
column = 0;
} else if (style.free_spacing) {
- os << '~';
+ // Some free spacing allows for multiple blanks
+ // so let ::latex() output them as is
+ if (!contains(style.pass_thru_chars, ' '))
+ os << '~';
} else {
os << ' ';
}
@@ -1066,7 +1069,8 @@ void Paragraph::Private::latexInset(BufferParams const &
bparams,
open_font = false;
}
- if (running_font.fontInfo().family() ==
TYPEWRITER_FAMILY)
+ if (running_font.fontInfo().family() ==
TYPEWRITER_FAMILY
+ && !contains(style.pass_thru_chars, ' '))
os << '~';
basefont = owner_->getLayoutFont(bparams, outerfont);
@@ -1209,7 +1213,11 @@ void Paragraph::Private::latexInset(BufferParams const &
bparams,
try {
runparams.lastid = id_;
runparams.lastpos = i;
- inset->latex(os, runparams);
+ if (!style.pass_thru_chars.empty())
+ runparams.pass_thru_chars += style.pass_thru_chars;
+ if ((inset->lyxCode() != NEWLINE_CODE && inset->lyxCode() !=
SEPARATOR_CODE)
+ || style.newline_allowed)
+ inset->latex(os, runparams);
} catch (EncodingException & e) {
// add location information and throw again.
e.par_id = id_;
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 731c57b06a..544805705d 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -1261,7 +1261,10 @@ void InsetMathHull::header_writeMath(TeXMathStream & os)
const
case hullSimple:
if (os.ulemCmd())
os << "\\mbox{";
- os << '$';
+ if (os.LaTeXDelims())
+ os << "\\(";
+ else
+ os << '$';
os.startOuterRow();
if (cell(0).empty())
os << ' ';
@@ -1326,7 +1329,10 @@ void InsetMathHull::footer_writeMath(TeXMathStream & os)
const
break;
case hullSimple:
- os << '$';
+ if (os.LaTeXDelims())
+ os << "\\)";
+ else
+ os << '$';
if (os.ulemCmd())
os << "}";
break;
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index facda69d93..4b911b17f5 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -380,6 +380,8 @@ void InsetMathNest::latex(otexstream & os, OutputParams
const & runparams) const
wi.canBreakLine(os.canBreakLine());
Changer dummy = wi.changeRowEntry(TexRow::textEntry(runparams.lastid,
runparams.lastpos));
+ // Use LaTeX inline delimiters if $ is a pass-thru char
+ wi.useLaTeXDelims(support::contains(runparams.pass_thru_chars, '$'));
writeMath(wi);
// Reset parbreak and command termination status after a math inset.
os.lastChar(0);
diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h
index 5bb5cceaf8..af5bec0a76 100644
--- a/src/mathed/MathStream.h
+++ b/src/mathed/MathStream.h
@@ -212,6 +212,10 @@ public:
Encoding const * encoding() const { return encoding_; }
///
docstring escapeChars() const { return escape_chars_; }
+ /// record whether we have to use LaTeX inline delimiters
+ void useLaTeXDelims(bool ltd) { latex_delims_ = ltd; }
+ /// tell whether to use LaTeX inline delimiters
+ bool LaTeXDelims() const { return latex_delims_; }
/// Temporarily change the TexRow information about the outer row entry.
Changer changeRowEntry(TexRow::RowEntry const & entry);
@@ -258,6 +262,8 @@ private:
bool mathclass_ = false;
///
docstring escape_chars_;
+ ///
+ bool latex_delims_ = false;
};
///
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index a59a0c7cd0..4a7d6334ca 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -1591,7 +1591,8 @@ void TeXOnePar(Buffer const & buf,
// we don't need a newline for the last paragraph!!!
// Note from JMarc: we will re-add a \n explicitly in
// TeXEnvironment, because it is needed in this case
- if (nextpar && !os.afterParbreak() && !last_was_separator &&
!last_multipar_command) {
+ if (nextpar && (!os.afterParbreak() || nextpar->allowEmpty())
+ && !last_was_separator && !last_multipar_command) {
if (!text.inset().getLayout().parbreakIgnored() && !merged_par)
// Make sure to start a new line
os << breakln;
@@ -1615,7 +1616,9 @@ void TeXOnePar(Buffer const & buf,
// environment and the alignment of the current and next
// paragraph is unchanged, or
// (case 5) the current alignment is changed and a
- // standard paragraph follows.
+ // standard paragraph follows, or
+ // (case 6) the current paragraph is empty and we allow
+ // empty pars
DocumentClass const & tclass = bparams.documentClass();
if ((style == next_layout
&& !style.parbreak_is_newline
@@ -1638,7 +1641,8 @@ void TeXOnePar(Buffer const & buf,
&& style.align == par.getAlign(bparams)
&& next_layout.align ==
nextpar->getAlign(bparams))
|| (style.align != par.getAlign(bparams)
- && tclass.isDefaultLayout(next_layout))) {
+ && tclass.isDefaultLayout(next_layout))
+ || (par.empty() && par.allowEmpty())) {
// and omit paragraph break if it has been
deleted with ct
// and changes are not shown in output
if (!merged_par) {
@@ -1837,7 +1841,7 @@ void latexParagraphs(Buffer const & buf,
} else {
// This is the last par
Paragraph const & cpar = paragraphs.at(pit);
- if ( !cpar.empty()
+ if (!cpar.empty()
&& cpar.isDeleted(0, cpar.size()) &&
!output_changes) {
if (!cpar.parEndChange().deleted())
os << '\n' << '\n';
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 2099b37f3d..355b9b03ee 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -376,6 +376,9 @@ const char * const known_lyx_packages[] = {"amsbsy",
"amsmath", "amssymb",
"tipx", "tone", "ulem", "url", "varioref", "verbatim", "wrapfig", "xcolor",
"xltabular",
"xunicode", "zref-clever", "zref-vario", 0};
+/// obsoleted LyX environments
+char const * const obsoleted_environments[] = {"lyxcode", 0};
+
// codes used to remove packages that are loaded automatically by LyX.
// Syntax: package_beg_sep<name>package_mid_sep<package loading
code>package_end_sep
const char package_beg_sep = '\001';
@@ -3444,7 +3447,7 @@ void Preamble::parse(Parser & p, string const &
forceclass,
string const opt2 = p.getFullOpt();
string const beg = p.verbatim_item();
string const end = p.verbatim_item();
- if (!in_lyx_preamble) {
+ if (!in_lyx_preamble || is_known(name,
obsoleted_environments)) {
h_preamble << "\\newenvironment{" << name
<< '}' << opt1 << opt2 << '{'
<< beg << "}{" << end << '}';
diff --git a/src/version.h b/src/version.h
index 0dd6564083..51f66629ad 100644
--- a/src/version.h
+++ b/src/version.h
@@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 659 // spitz: MathJax
-#define LYX_FORMAT_TEX2LYX 659
+#define LYX_FORMAT_LYX 660 // spitz: ditch LyXCode
+#define LYX_FORMAT_TEX2LYX 660
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs