]> git.lyx.org Git - features.git/commitdiff
backporting tex2lyx: the \printnomenclature support
authorUwe Stöhr <uwestoehr@web.de>
Wed, 26 Oct 2011 01:47:47 +0000 (01:47 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Wed, 26 Oct 2011 01:47:47 +0000 (01:47 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39997 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/TODO.txt
src/tex2lyx/text.cpp

index 2b3abc5c19ec17e101bf5103d04d80ef32ebe93d..b8dc65fee28f1eaa486521338e2c6b3fa57daca9 100644 (file)
@@ -57,8 +57,6 @@ Format LaTeX feature                        LyX feature
 356    \uuline, \uwave                      fonts
 358    custom bibtex command                \bibtex_command
 358    custom makeindex command             \index_command
-359    set_width                            InsetCommand nomencl_print
-360    width                                InsetCommand nomencl_print
 362    applemac encoding                    \encoding
 363    horizontal longtable alignment       InsetTabular
 364    branch file name suffix              \filename_suffix
index 697e14754fdc332b7cd8c639936c5753c24bf392..966534c0090ea1aa1cf0bcbbe4532683bbdf950c 100644 (file)
@@ -2687,8 +2687,27 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                }
 
                else if (t.cs() == "printnomenclature") {
+                       string width = "";
+                       string width_type = "";
                        context.check_layout(os);
                        begin_command_inset(os, "nomencl_print", "printnomenclature");
+                       // case of a custom width
+                       if (p.hasOpt()) {
+                               width = p.getArg('[', ']');
+                               width = translate_len(width);
+                               width_type = "custom";
+                       }
+                       // case of no custom width
+                       // the case of no custom width but the width set
+                       // via \settowidth{\nomlabelwidth}{***} cannot be supported
+                       // because the user could have set anything, not only the width
+                       // of the longest label (which would be width_type = "auto")
+                       string label = convert_command_inset_arg(p.getArg('{', '}'));
+                       if (label.empty() && width_type.empty())
+                               width_type = "none";
+                       os << "set_width \"" << width_type << "\"\n";
+                       if (width_type == "custom")
+                               os << "width \"" << width << '\"';
                        end_inset(os);
                        skip_spaces_braces(p);
                }