return
colorcode = get_value(document.header, '\\backgroundcolor', 0)
del document.header[i]
+ # don't clutter the preamble if backgroundcolor is not set
+ if colorcode == "#ffffff":
+ continue
# the color code is in the form #rrggbb where every character denotes a hex number
# convert the string to an int
red = string.atoi(colorcode[1:3],16)
def revert_uulinewave(document):
- " Reverts \\uuline and \\uwave character style "
+ " Reverts \\uline, \\uuline, and \\uwave character styles "
while True:
i = find_token(document.body, '\\uuline', 0)
if i == -1:
while True:
i = find_token(document.body, '\\uwave', 0)
if i == -1:
- return
+ break
del document.body[i]
+ i = find_token(document.body, '\\bar under', 0)
+ if i == -1:
+ return
+ insert_to_preamble(0, document,
+ '% Commands inserted by lyx2lyx for proper underlining\n'
+ + '\\PassOptionsToPackage{normalem}{ulem}\n'
+ + '\\usepackage{ulem}\n'
+ + '\\let\\cite@rig\\cite\n'
+ + '\\newcommand{\\b@xcite}[2][\\%]{\\def\\def@pt{\\%}\\def\\pas@pt{#1}\n'
+ + ' \\mbox{\\ifx\\def@pt\\pas@pt\\cite@rig{#2}\\else\\cite@rig[#1]{#2}\\fi}}\n'
+ + '\\renewcommand{\\underbar}[1]{{\\let\\cite\\b@xcite\\uline{#1}}}\n')
##
env = true; //We have opened a new environment
}
if (f.underbar() == FONT_ON) {
- os << "\\uline{";
+ os << "\\lyxuline{";
count += 10;
env = true; //We have opened a new environment
}
if (f.strikeout() == FONT_ON) {
- os << "\\sout{";
- count += 6;
+ os << "\\lyxsout{";
+ count += 9;
env = true; //We have opened a new environment
}
if (f.uuline() == FONT_ON) {
- os << "\\uuline{";
- count += 8;
+ os << "\\lyxuuline{";
+ count += 11;
env = true; //We have opened a new environment
}
if (f.uwave() == FONT_ON) {
- os << "\\uwave{";
- count += 7;
+ os << "\\lyxuwave{";
+ count += 10;
env = true; //We have opened a new environment
}
// \noun{} is a LyX special macro
LYXERR(Debug::LATEX, "Noun enabled. Font: " << to_utf8(stateText(0)));
}
if (bits_.underbar() == FONT_ON) {
- LYXERR(Debug::LATEX, "font.underline: " << bits_.strikeout());
+ LYXERR(Debug::LATEX, "font.underline: " << bits_.underbar());
features.require("ulem");
+ features.require("boxcite");
+ features.require("lyxuline");
LYXERR(Debug::LATEX, "Underline enabled. Font: " << to_utf8(stateText(0)));
}
if (bits_.strikeout() == FONT_ON) {
LYXERR(Debug::LATEX, "font.strikeout: " << bits_.strikeout());
features.require("ulem");
+ features.require("boxcite");
+ features.require("lyxsout");
LYXERR(Debug::LATEX, "Strikeout enabled. Font: " << to_utf8(stateText(0)));
}
if (bits_.uuline() == FONT_ON) {
LYXERR(Debug::LATEX, "font.uuline: " << bits_.uuline());
features.require("ulem");
+ features.require("boxcite");
+ features.require("lyxuuline");
LYXERR(Debug::LATEX, "Double underline enabled. Font: " << to_utf8(stateText(0)));
}
if (bits_.uwave() == FONT_ON) {
LYXERR(Debug::LATEX, "font.uwave: " << bits_.uwave());
features.require("ulem");
+ features.require("boxcite");
+ features.require("lyxuwave");
LYXERR(Debug::LATEX, "Wavy underline enabled. Font: " << to_utf8(stateText(0)));
}
switch (bits_.color()) {
"%% A simple dot to overcome graphicx limitations\n"
"\\newcommand{\\lyxdot}{.}\n";
+static string const boxcite_def =
+ "\\let\\cite@rig\\cite\n"
+ "\\newcommand{\\b@xcite}[2][\\%]{\\def\\def@pt{\\%}\\def\\pas@pt{#1}\n"
+ " \\mbox{\\ifx\\def@pt\\pas@pt\\cite@rig{#2}\\else\\cite@rig[#1]{#2}\\fi}}\n";
+
+static string const lyxuline_def =
+ "\\newcommand{\\lyxuline}[1]{{\\let\\cite\\b@xcite\\uline{#1}}}\n";
+
+static string const lyxuuline_def =
+ "\\newcommand{\\lyxuuline}[1]{{\\let\\cite\\b@xcite\\uuline{#1}}}\n";
+
+static string const lyxuwave_def =
+ "\\newcommand{\\lyxuwave}[1]{{\\let\\cite\\b@xcite\\uwave{#1}}}\n";
+
+static string const lyxsout_def =
+ "\\newcommand{\\lyxsout}[1]{{\\let\\cite\\b@xcite\\sout{#1}}}\n";
+
static string const changetracking_dvipost_def =
"%% Change tracking with dvipost\n"
"\\dvipostlayout\n"
if (mustProvide("lyxline"))
macros << lyxline_def << '\n';
+ if (mustProvide("boxcite"))
+ macros << boxcite_def << '\n';
+
+ if (mustProvide("lyxuline"))
+ macros << lyxuline_def << '\n';
+
+ if (mustProvide("lyxuuline"))
+ macros << lyxuuline_def << '\n';
+
+ if (mustProvide("lyxuwave"))
+ macros << lyxuwave_def << '\n';
+
+ if (mustProvide("lyxsout"))
+ macros << lyxsout_def << '\n';
+
if (mustProvide("noun"))
macros << noun_def << '\n';