From: Martin Vermeer Date: Sat, 20 Oct 2007 17:05:28 +0000 (+0000) Subject: Verbatim for URL inset, \protect for special phrases (index inset) X-Git-Tag: 1.6.10~7752 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ccacb487f2a1cabd47b6e87b4494e12824fb26e0;p=features.git Verbatim for URL inset, \protect for special phrases (index inset) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21083 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/layouts/url.module b/lib/layouts/url.module index 09eba0f5a7..c8d9576e91 100644 --- a/lib/layouts/url.module +++ b/lib/layouts/url.module @@ -8,11 +8,15 @@ InsetLayout URL LatexName url Decoration minimalistic LabelString URL + Verbatim true Font Family Typewriter + Color Blue EndFont LabelFont Family Typewriter + Color Blue + Size Small EndFont Preamble \usepackage{url} diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index 0d4dae0e29..85775dc0f2 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -25,7 +25,7 @@ OutputParams::OutputParams(Encoding const * enc) inComment(false), inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED), par_begin(0), par_end(0), - dryrun(false) + dryrun(false), verbatim(false) {} diff --git a/src/OutputParams.h b/src/OutputParams.h index c45c109229..dc2bc365f7 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -146,6 +146,8 @@ public: * This mode will be used to preview the source code */ bool dryrun; + /// Should we output verbatim or escape LaTeX's special chars? + bool verbatim; }; diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 9e8483432d..db753e91c9 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -186,10 +186,10 @@ struct special_phrase { }; special_phrase const special_phrases[] = { - { "LyX", from_ascii("\\LyX{}"), false }, - { "TeX", from_ascii("\\TeX{}"), true }, - { "LaTeX2e", from_ascii("\\LaTeXe{}"), true }, - { "LaTeX", from_ascii("\\LaTeX{}"), true }, + { "LyX", from_ascii("\\protect\\LyX{}"), false }, + { "TeX", from_ascii("\\protect\\TeX{}"), true }, + { "LaTeX2e", from_ascii("\\protect\\LaTeXe{}"), true }, + { "LaTeX", from_ascii("\\protect\\LaTeX{}"), true }, }; size_t const phrases_nr = sizeof(special_phrases)/sizeof(special_phrase); @@ -775,6 +775,11 @@ void Paragraph::Private::simpleTeXSpecialChar( unsigned int & column, value_type const c) { + if (runparams.verbatim) { + os.put(c); + return; + } + switch (c) { case '\\': os << "\\textbackslash{}"; diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 4159ff36a7..d9355d870a 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -634,7 +634,10 @@ int InsetCollapsable::latex(Buffer const & buf, odocstream & os, os << from_utf8(layout_.latexparam); } } - int i = InsetText::latex(buf, os, runparams); + OutputParams rp = runparams; + if (layout_.verbatim) + rp.verbatim = true; + int i = InsetText::latex(buf, os, rp); if (!layout_.latexname.empty()) { if (layout_.latextype == "command") { os << "}";