From ca5838b017d01afd7defa15fd46a0566d5a98f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 6 Dec 2006 16:46:57 +0000 Subject: [PATCH] Support for the EURO sign (bug 845): * lib/chkconfig.ltx: check for the textcomp package * lib/doc/LaTeXConfig.lyx.in: document textcomp * src/LaTeXFeatures.C (simplefeatures): add textcomp * src/paragraph_pimpl.C (simpleTeXSpecialChar): support the Euro sign (via textcomp command) * src/paragraph_pimpl.C (validate): require textcomp if we have a Euro symbol git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16193 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/chkconfig.ltx | 1 + lib/doc/LaTeXConfig.lyx.in | 27 ++++++++++++++++++++++++++- src/LaTeXFeatures.C | 1 + src/paragraph_pimpl.C | 21 +++++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index e9f983a67c..cbf8a184dc 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -230,6 +230,7 @@ \TestPackage{rotating} \TestPackage{setspace} \TestPackage{subfigure} +\TestPackage{textcomp} \TestPackage{varioref} \TestPackage{url} diff --git a/lib/doc/LaTeXConfig.lyx.in b/lib/doc/LaTeXConfig.lyx.in index 029feea46a..26defce636 100644 --- a/lib/doc/LaTeXConfig.lyx.in +++ b/lib/doc/LaTeXConfig.lyx.in @@ -2516,6 +2516,31 @@ booktabs is needed by LyX to be able to output correctly formal tables. \end_layout +\begin_layout Subsection +textcomp +\end_layout + +\begin_layout Description +Found: @chk_textcomp@ +\end_layout + +\begin_layout Description +CTAN: +\family typewriter +macros/latex/unpacked/textcomp.sty +\end_layout + +\begin_layout Description +Notes: The package +\family sans +textcomp +\family default + is needed by LyX to output some special symbols like the EURO currency + sign. + The package is part of the LaTeX base distribution and should already be + installed on your system. +\end_layout + \begin_layout Subsection varioref \end_layout @@ -2532,7 +2557,7 @@ macros/latex/required/tools/ \begin_layout Description Notes: The package -\family typewriter +\family sans varioref \family default introduces some commands to generate references with an information about diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index 4d82a9bde2..18c348359a 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -247,6 +247,7 @@ char const * simplefeatures[] = { "nicefrac", "tipa", "framed", + "textcomp", }; int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index aad1f2bb49..19d1f1c4e7 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -651,6 +651,24 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const & buf, } break; + case 0x20ac: // EURO SIGN + if ((bparams.inputenc == "latin9" || + bparams.inputenc == "cp1251"|| + bparams.inputenc == "utf8") || + (bparams.inputenc == "auto" && + (font.language()->encoding()->latexName() + == "latin9" || + font.language()->encoding()->latexName() + == "cp1251"|| + font.language()->encoding()->latexName() + == "utf8"))) { + os.put(c); + } else { + os << "\\texteuro{}"; + column += 10; + } + break; + case '$': case '&': case '%': case '#': case '{': case '}': case '_': @@ -801,6 +819,9 @@ void Paragraph::Pimpl::validate(LaTeXFeatures & features, break; } } + // the euro sign requires the textcomp package + if (getChar(i) == 0x20ac) + features.require("textcomp"); } }