Pavel Sanda wrote:

> I just blindly copied what was there for other on-off packages, because
> I have little clue what tex2lyx code does and zero comments in critical
> sections does not help. I know it's not your fault ;)

Actually the other packages are not on-off, they are off-auto-on. This is 
needed for all packages automatically loaded by math commands. It is not 
needed for microtype, since ther is no automatism.

The minimum thing you need to do is to write the format corresponding to 
LYX_FORMAT_TEX2LYX (see attached). The actual recognition of a loaded 
microtype package can be done later (this is the reason why you need a TODO 
entry).


Georg
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 24c403d..35f5c11 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -457,7 +457,8 @@ string remove_braces(string const & value)
 
 
 Preamble::Preamble() : one_language(true), explicit_babel(false),
-	title_layout_found(false), index_number(0), h_font_cjk_set(false)
+	title_layout_found(false), index_number(0), h_font_cjk_set(false),
+	h_use_microtype(false)
 {
 	//h_backgroundcolor;
 	//h_boxbgcolor;
@@ -487,6 +488,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
 	h_font_tt_scale[0]        = "100";
 	h_font_tt_scale[1]        = "100";
 	//h_font_cjk
+	//h_use_microtype
 	h_graphics                = "default";
 	h_default_output_format   = "default";
 	h_html_be_strict          = "false";
@@ -1162,7 +1164,8 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
 	   << ' ' << h_font_tt_scale[1] << '\n';
 	if (!h_font_cjk.empty())
 		os << "\\font_cjk " << h_font_cjk << '\n';
-	os << "\\graphics " << h_graphics << '\n'
+	os << "\\use_microtype " << h_use_microtype << '\n'
+	   << "\\graphics " << h_graphics << '\n'
 	   << "\\default_output_format " << h_default_output_format << "\n"
 	   << "\\output_sync " << h_output_sync << "\n";
 	if (h_output_sync == "1")
diff --git a/src/tex2lyx/Preamble.h b/src/tex2lyx/Preamble.h
index f9342ef..350644d 100644
--- a/src/tex2lyx/Preamble.h
+++ b/src/tex2lyx/Preamble.h
@@ -151,6 +151,7 @@ private:
 	std::string h_font_tt_scale[2];
 	bool h_font_cjk_set;
 	std::string h_font_cjk;
+	bool h_use_microtype;
 	std::string h_graphics;
 	std::string h_default_output_format;
 	std::string h_html_be_strict;

Reply via email to