+ p.setCatcode('@', catOther);
+ }
+
+ else if (t.cs() == "makeindex") {
+ // LyX will re-add this if a print index command is found
+ p.skip_spaces();
+ }
+
+ else if (t.cs() == "newindex") {
+ string const indexname = p.getArg('[', ']');
+ string const shortcut = p.verbatim_item();
+ if (!indexname.empty())
+ h_index[index_number] = indexname;
+ else
+ h_index[index_number] = shortcut;
+ h_shortcut[index_number] = shortcut;
+ index_number += 1;
+ p.skip_spaces();
+ }
+
+ else if (t.cs() == "RS@ifundefined") {
+ string const name = p.verbatim_item();
+ string const body1 = p.verbatim_item();
+ string const body2 = p.verbatim_item();
+ // only non-lyxspecific stuff
+ if (in_lyx_preamble &&
+ (name == "subref" || name == "thmref" || name == "lemref"))
+ p.skip_spaces();
+ else {
+ ostringstream ss;
+ ss << '\\' << t.cs();
+ ss << '{' << name << '}'
+ << '{' << body1 << '}'
+ << '{' << body2 << '}';
+ h_preamble << ss.str();
+ }
+ }
+
+ else if (t.cs() == "AtBeginDocument") {
+ string const name = p.verbatim_item();
+ // only non-lyxspecific stuff
+ if (in_lyx_preamble &&
+ (name == "\\providecommand\\partref[1]{\\ref{part:#1}}"
+ || name == "\\providecommand\\chapref[1]{\\ref{chap:#1}}"
+ || name == "\\providecommand\\secref[1]{\\ref{sec:#1}}"
+ || name == "\\providecommand\\subref[1]{\\ref{sub:#1}}"
+ || name == "\\providecommand\\parref[1]{\\ref{par:#1}}"
+ || name == "\\providecommand\\figref[1]{\\ref{fig:#1}}"
+ || name == "\\providecommand\\tabref[1]{\\ref{tab:#1}}"
+ || name == "\\providecommand\\algref[1]{\\ref{alg:#1}}"
+ || name == "\\providecommand\\fnref[1]{\\ref{fn:#1}}"
+ || name == "\\providecommand\\enuref[1]{\\ref{enu:#1}}"
+ || name == "\\providecommand\\eqref[1]{\\ref{eq:#1}}"
+ || name == "\\providecommand\\lemref[1]{\\ref{lem:#1}}"
+ || name == "\\providecommand\\thmref[1]{\\ref{thm:#1}}"
+ || name == "\\providecommand\\corref[1]{\\ref{cor:#1}}"
+ || name == "\\providecommand\\propref[1]{\\ref{prop:#1}}"))
+ p.skip_spaces();
+ else {
+ ostringstream ss;
+ ss << '\\' << t.cs();
+ ss << '{' << name << '}';
+ h_preamble << ss.str();
+ }