From 5fc072a079931f8bbf6cc6c047ab1ff8edb29f77 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 22 Oct 2011 19:54:31 +0000 Subject: [PATCH] Support fontenc options in tex2lyx git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39926 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/TODO.txt | 1 - src/tex2lyx/preamble.cpp | 13 +++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt index 9316c8959e..cafa32226a 100644 --- a/src/tex2lyx/TODO.txt +++ b/src/tex2lyx/TODO.txt @@ -72,7 +72,6 @@ Format LaTeX feature LyX feature 369 author id \author 370 \date{} \suppress_date 371 automatic mhchem loading \use_mhchem -372 font encoding \fontencoding 375 \includeonly \{begin,end}_includeonly 376 update .aux of unincluded children \maintain_unincluded_children 377 multirow.sty InsetTabular diff --git a/src/tex2lyx/preamble.cpp b/src/tex2lyx/preamble.cpp index 1394288198..0ead8d4a76 100644 --- a/src/tex2lyx/preamble.cpp +++ b/src/tex2lyx/preamble.cpp @@ -171,6 +171,7 @@ string h_use_default_options = "false"; string h_options; string h_language = "english"; string h_language_package = "default"; +string h_fontencoding = "default"; string h_font_roman = "default"; string h_font_sans = "default"; string h_font_typewriter = "default"; @@ -531,8 +532,15 @@ void handle_package(Parser &p, string const & name, string const & opts, delete_opt(options, known_languages); } - else if (name == "fontenc") - ;// ignore this + else if (name == "fontenc") { + h_fontencoding = getStringFromVector(options, ","); + /* We could do the following for better round trip support, + * but this makes the document less portable, so I skip it: + if (h_fontencoding == lyxrc.fontenc) + h_fontencoding = "global"; + */ + options.clear(); + } else if (name == "inputenc" || name == "luainputenc") { // h_inputencoding is only set when there is not more than one @@ -696,6 +704,7 @@ void end_preamble(ostream & os, TextClass const & /*textclass*/) << "\\language " << h_language << "\n" << "\\language_package " << h_language_package << "\n" << "\\inputencoding " << h_inputencoding << "\n" + << "\\fontencoding " << h_fontencoding << "\n" << "\\font_roman " << h_font_roman << "\n" << "\\font_sans " << h_font_sans << "\n" << "\\font_typewriter " << h_font_typewriter << "\n" -- 2.39.5