mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Add a layout tag ForceOwnlines that assures an inset is started and terminated by a line break in the LaTeX output.
Fixes: #8875.
This commit is contained in:
parent
e5e8bff75b
commit
a25569ebb3
@ -1,5 +1,5 @@
|
||||
#LyX 2.1 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 476
|
||||
#LyX 2.2 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 479
|
||||
\begin_document
|
||||
\begin_header
|
||||
\textclass scrbook
|
||||
@ -17019,6 +17019,59 @@ g.
|
||||
|
||||
in TeX code or URL.
|
||||
A kludge.
|
||||
\change_inserted -712698321 1417441977
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1417442090
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1417441983
|
||||
ForceOwnlines
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
[
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1417441978
|
||||
|
||||
\emph on
|
||||
0
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
,
|
||||
\begin_inset space \thinspace{}
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1417441978
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
] Force a a line break in the LaTeX output before the inset starts and after
|
||||
the inset ends.
|
||||
This assures the inset itself is output on its own lines, for parsing purposes.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
@ -23533,7 +23586,7 @@ name "chap:List-of-functions"
|
||||
\align center
|
||||
\begin_inset Tabular
|
||||
<lyxtabular version="3" rows="11" columns="8">
|
||||
<features rotate="0" tabularvalignment="middle">
|
||||
<features tabularvalignment="middle">
|
||||
<column alignment="left" valignment="top">
|
||||
<column alignment="left" valignment="top">
|
||||
<column alignment="left" valignment="top">
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Note that this file is included in sweave.module,
|
||||
# knitr.module and noweb.module.
|
||||
|
||||
Format 49
|
||||
Format 52
|
||||
|
||||
Counter chunk
|
||||
PrettyFormat "Chunk ##"
|
||||
@ -23,15 +23,15 @@ InsetLayout "Flex:Chunk"
|
||||
Color latex
|
||||
Family typewriter
|
||||
EndFont
|
||||
#LabelFont
|
||||
#Color latex
|
||||
#Size Small
|
||||
#EndFont
|
||||
MultiPar true
|
||||
# LabelFont
|
||||
# Color latex
|
||||
# Size Small
|
||||
# EndFont
|
||||
MultiPar true
|
||||
CustomPars false
|
||||
ForcePlain true
|
||||
PassThru 1
|
||||
ParbreakIsNewline 1
|
||||
PassThru 1
|
||||
ParbreakIsNewline 1
|
||||
KeepEmpty true
|
||||
Spellcheck 0
|
||||
FreeSpacing true
|
||||
@ -43,5 +43,6 @@ InsetLayout "Flex:Chunk"
|
||||
LeftDelim <<
|
||||
RightDelim >>=<br/>
|
||||
EndArgument
|
||||
ResetsFont false
|
||||
ResetsFont false
|
||||
ForceOwnlines true
|
||||
End
|
||||
|
@ -171,6 +171,9 @@ import os, re, string, sys
|
||||
# Incremented to format 51, 29 May 2014 by spitz
|
||||
# New Style tag "ToggleIndent"
|
||||
|
||||
# Incremented to format 52, 1 December 2014 by spitz
|
||||
# New InsetLayout tag "ForceOwnlines"
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
@ -178,7 +181,7 @@ import os, re, string, sys
|
||||
# development/tools/updatelayouts.py script to update all
|
||||
# layout files to the new format.
|
||||
|
||||
currentFormat = 51
|
||||
currentFormat = 52
|
||||
|
||||
|
||||
def usage(prog_name):
|
||||
@ -402,7 +405,7 @@ def convert(lines):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
if format == 50:
|
||||
if format == 50 or format == 51:
|
||||
# nothing to do.
|
||||
i += 1
|
||||
continue
|
||||
|
@ -61,7 +61,7 @@ namespace lyx {
|
||||
// You should also run the development/tools/updatelayouts.py script,
|
||||
// to update the format of all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 51; //spitz: add ToggleIndent tag
|
||||
int const LAYOUT_FORMAT = 52; //spitz: add ForceOwnlines tag
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -89,6 +89,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
IL_FONT,
|
||||
IL_FORCE_LOCAL_FONT_SWITCH,
|
||||
IL_FORCELTR,
|
||||
IL_FORCEOWNLINES,
|
||||
IL_FORCEPLAIN,
|
||||
IL_FREESPACING,
|
||||
IL_HTMLTAG,
|
||||
@ -139,6 +140,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
{ "font", IL_FONT },
|
||||
{ "forcelocalfontswitch", IL_FORCE_LOCAL_FONT_SWITCH },
|
||||
{ "forceltr", IL_FORCELTR },
|
||||
{ "forceownlines", IL_FORCEOWNLINES },
|
||||
{ "forceplain", IL_FORCEPLAIN },
|
||||
{ "freespacing", IL_FREESPACING },
|
||||
{ "htmlattr", IL_HTMLATTR },
|
||||
@ -256,6 +258,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
case IL_FORCELTR:
|
||||
lex >> forceltr_;
|
||||
break;
|
||||
case IL_FORCEOWNLINES:
|
||||
lex >> forceownlines_;
|
||||
break;
|
||||
case IL_INTOC:
|
||||
lex >> intoc_;
|
||||
break;
|
||||
|
@ -164,6 +164,8 @@ public:
|
||||
///
|
||||
bool forceLTR() const { return forceltr_; }
|
||||
///
|
||||
bool forceOwnlines() const { return forceownlines_; }
|
||||
///
|
||||
bool isInToc() const { return intoc_; }
|
||||
///
|
||||
bool spellcheck() const { return spellcheck_; }
|
||||
@ -262,6 +264,8 @@ private:
|
||||
///
|
||||
bool forceltr_;
|
||||
///
|
||||
bool forceownlines_;
|
||||
///
|
||||
bool needprotect_;
|
||||
/// should the contents be written to TOC strings?
|
||||
bool intoc_;
|
||||
|
@ -433,6 +433,8 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
|
||||
// environment. Standard collapsable insets should not
|
||||
// redefine this, non-standard ones may call this.
|
||||
InsetLayout const & il = getLayout();
|
||||
if (il.forceOwnlines())
|
||||
os << breakln;
|
||||
if (!il.latexname().empty()) {
|
||||
if (il.latextype() == InsetLayout::COMMAND) {
|
||||
// FIXME UNICODE
|
||||
@ -495,11 +497,13 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
|
||||
os << breakln;
|
||||
else
|
||||
os << safebreakln;
|
||||
os << "\\end{" << from_utf8(il.latexname()) << "}\n";
|
||||
os << "\\end{" << from_utf8(il.latexname()) << "}" << breakln;
|
||||
if (!il.isDisplay())
|
||||
os.protectSpace(true);
|
||||
}
|
||||
}
|
||||
if (il.forceOwnlines())
|
||||
os << breakln;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user