-----------------------
+2019-05-21 Pavel Sanda <sanda@lyx.org>
+ * Format incremented to 575: add line numbering via lineno package
+
2019-04-16 Günter Milde <milde@lyx.org>
* Format incremented to 574: Ruby inset, fixes for Japanese.
if lang == "japanese-cjk":
document.set_parameter("inputencoding", "utf8-cjk")
+def revert_lineno(document):
+ " Remove lineno package use."
+ i = find_token(document.header, "\\use_lineno", 0)
+ if i != -1:
+ del document.header[i]
+ i = find_token(document.header, "\\lineno_options", 0)
+ if i != -1:
+ del document.header[i]
+
##
# Conversion hub
[572, [convert_notoFonts]], # Added options thin, light, extralight for Noto
[573, [convert_inputencoding_namechange]],
[574, [convert_ruby_module, convert_utf8_japanese]],
+ [575, []],
]
-revert = [[573, [revert_ruby_module, revert_utf8_japanese]],
+revert = [[574, [revert_lineno]],
+ [573, [revert_ruby_module, revert_utf8_japanese]],
[572, [revert_inputencoding_namechange]],
[571, [revert_notoFonts]],
[570, [revert_cmidruletrimming]],
output_sync = false;
use_refstyle = true;
use_minted = false;
+ use_lineno = false;
// map current author
author_map_[pimpl_->authorlist.get(0).bufferId()] = 0;
lex >> use_refstyle;
} else if (token == "\\use_minted") {
lex >> use_minted;
+ } else if (token == "\\use_lineno") {
+ lex >> use_lineno;
+ } else if (token == "\\lineno_options") {
+ lex.eatLine();
+ lineno_opts = trim(lex.getString());
} else {
lyxerr << "BufferParams::readToken(): Unknown token: " <<
token << endl;
<< "\n\\use_refstyle " << use_refstyle
<< "\n\\use_minted " << use_minted
<< '\n';
+
+ if (use_lineno)
+ os << "\\use_lineno " << use_lineno << '\n';
+ if (!lineno_opts.empty())
+ os << "\\lineno_options " << lineno_opts << '\n';
+
if (isbackgroundcolor == true)
os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
if (isfontcolor == true)
// hyperref loads this automatically
os << "\\usepackage{nameref}\n";
+ if (use_lineno){
+ os << "\\usepackage";
+ if (!lineno_opts.empty())
+ os << "[" << lineno_opts << "]";
+ os << "{lineno}\n";
+ os << "\\linenumbers\n";
+ }
+
// bibtopic needs to be loaded after hyperref.
// the dot provides the aux file naming which LyX can detect.
if (features.mustProvide("bibtopic"))
bool use_refstyle;
/// use minted? or listings?
bool use_minted;
+ //output line numbering
+ bool use_lineno;
+ //optional params for lineno package
+ std::string lineno_opts;
/// Return true if language could be set to lang,
/// otherwise return false and do not change language
numberingModule->tocTW->headerItem()->setText(1, qt_("Numbered"));
numberingModule->tocTW->headerItem()->setText(2, qt_("Appears in TOC"));
setSectionResizeMode(numberingModule->tocTW->header(), QHeaderView::ResizeToContents);
+ connect(numberingModule->linenoGB, SIGNAL(clicked()),
+ this, SLOT(change_adaptor()));
+ connect(numberingModule->linenoLE, SIGNAL(textChanged(QString)),
+ this, SLOT(change_adaptor()));
+
// biblio
biblioModule = new UiWidget<Ui::BiblioUi>(this);
bp_.tocdepth = numberingModule->tocSL->value();
bp_.secnumdepth = numberingModule->depthSL->value();
}
+ bp_.use_lineno = numberingModule->linenoGB->isChecked();
+ bp_.lineno_opts = fromqstr(numberingModule->linenoLE->text());
// bullets
bp_.user_defined_bullet(0) = bulletsModule->bullet(0);
numberingModule->tocTW->clear();
}
+ numberingModule->linenoGB->setChecked(bp_.use_lineno);
+ numberingModule->linenoLE->setText(toqstr(bp_.lineno_opts));
+
// bullets
bulletsModule->setBullet(0, bp_.user_defined_bullet(0));
bulletsModule->setBullet(1, bp_.user_defined_bullet(1));
</property>
</widget>
</item>
+ <item row="5" column="0">
+ <widget class="QGroupBox" name="linenoGB">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>L&ines numbering</string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Additional O&ptions:</string>
+ </property>
+ <property name="buddy">
+ <cstring>linenoLE</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="linenoLE">
+ <property name="toolTip">
+ <string>lineno package options (e.g. right, modulo, switch, displaymath, mathlines,...)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<tabstops>
443 unicode-math.sty InsetMath*
453 automatic stmaryrd loading \use_package stmaryrd
457 automatic stackrel loading \use_package stackrel
+575 numbering of lines (lineno) \use_lineno, \lineno_options
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 574 // gm: Japanese fixes
-#define LYX_FORMAT_TEX2LYX 574
+#define LYX_FORMAT_LYX 575 // ps: lineno
+#define LYX_FORMAT_TEX2LYX 575
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER