mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Solve problem with underlining citations.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29550 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1990c00e5c
commit
cd62043a1b
@ -435,6 +435,9 @@ def revert_backgroundcolor(document):
|
||||
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)
|
||||
@ -615,7 +618,7 @@ def revert_strikeout(document):
|
||||
|
||||
|
||||
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:
|
||||
@ -624,8 +627,19 @@ def revert_uulinewave(document):
|
||||
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')
|
||||
|
||||
|
||||
##
|
||||
|
24
src/Font.cpp
24
src/Font.cpp
@ -552,23 +552,23 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
|
||||
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
|
||||
@ -819,23 +819,31 @@ void Font::validate(LaTeXFeatures & features) const
|
||||
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()) {
|
||||
|
@ -164,6 +164,23 @@ static string const lyxdot_def =
|
||||
"%% 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"
|
||||
@ -742,6 +759,21 @@ string const LaTeXFeatures::getMacros() const
|
||||
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';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user