New simplified definition of \lyxmathsym and better re-import from latex.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@28989 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-03-31 11:29:31 +00:00
parent 7ed0249324
commit 4f2d5f39ee
7 changed files with 33 additions and 30 deletions

View File

@ -228,6 +228,7 @@
%%% Packages
\TestPackage{accents}
\TestPackage{algorithm}
\TestPackage{amstext}
\TestPackage{array}
\TestPackage{babel}
\TestPackage{bibtopic}
@ -262,7 +263,6 @@
\TestPackage{pdfpages}
\TestPackage{prettyref}
\TestPackage{preview}
\TestPackage{relsize}
\TestPackage{rotating}
\TestPackage{rotfloat}
\TestPackage{setspace}

View File

@ -3537,14 +3537,14 @@ longtable
\end_layout
\begin_layout Subsection
relsize
amstext
\end_layout
\begin_layout Description
Found:
\begin_inset Info
type "package"
arg "relsize"
arg "amstext"
\end_inset
@ -3553,13 +3553,13 @@ arg "relsize"
\begin_layout Description
CTAN:
\family typewriter
macros/latex/contrib/misc/
macros/latex/required/amslatex/math/
\end_layout
\begin_layout Description
Notes: The package
\family sans
relsize
amstext
\family default
is needed by LyX to correctly size unicode symbols used as super or subscripts
in math.

View File

@ -3277,14 +3277,14 @@ longtable
\end_layout
\begin_layout Subsection
relsize
amstext
\end_layout
\begin_layout Description
検出:
\begin_inset Info
type "package"
arg "relsize"
arg "amstext"
\end_inset
@ -3293,13 +3293,13 @@ arg "relsize"
\begin_layout Description
CTAN:
\family typewriter
macros/latex/contrib/misc/
macros/latex/required/amslatex/math/
\end_layout
\begin_layout Description
備考:
\family sans
relsize
amstext
\family default
パッケージは、unicodeシンボルを数式内で上付きや下付き文字にする際、LyXが正しい寸法に調整するのに必要とします。
\end_layout

View File

@ -601,7 +601,7 @@ void Encodings::validate(char_type c, LaTeXFeatures & features, bool for_mathed)
}
}
if (for_mathed && isMathSym(c)) {
features.require("relsize");
features.require("amstext");
features.require("lyxmathsym");
}
#endif

View File

@ -201,11 +201,8 @@ static string const textcyr_def =
"\\AtBeginDocument{\\DeclareFontEncoding{T2A}{}{}}\n";
static string const lyxmathsym_def =
"\\DeclareRobustCommand{\\lyxmathsym}[1]{\\ifmmode\\begingroup\\def\\b@ld{bold}\n"
" \\def\\rmorbf##1{\\ifx\\math@version\\b@ld\\textbf{##1}\\else\\textrm{##1}\\fi}\n"
" \\mathchoice{\\hbox{\\rmorbf{#1}}}{\\hbox{\\rmorbf{#1}}}\n"
" {\\hbox{\\smaller[2]\\rmorbf{#1}}}{\\hbox{\\smaller[3]\\rmorbf{#1}}}\n"
" \\endgroup\\else#1\\fi}\n";
"\\newcommand{\\lyxmathsym}[1]{\\ifmmode\\begingroup\\def\\b@ld{bold}\n"
" \\text{\\ifx\\math@version\\b@ld\\bfseries\\fi#1}\\endgroup\\else#1\\fi}\n";
static string const papersizedvi_def =
"\\special{papersize=\\the\\paperwidth,\\the\\paperheight}\n";
@ -513,7 +510,6 @@ char const * simplefeatures[] = {
// listings is handled in BufferParams.cpp
"bm",
"pdfpages",
"relsize",
"amscd",
"slashed"
};
@ -585,9 +581,12 @@ string const LaTeXFeatures::getPackages() const
&& params_.use_esint == BufferParams::package_off
&& params_.use_amsmath != BufferParams::package_off)) {
packages << "\\usepackage{amsmath}\n";
} else if (mustProvide("amsbsy")) {
// amsbsy is already provided by amsmath
packages << "\\usepackage{amsbsy}\n";
} else {
// amsbsy and amstext are already provided by amsmath
if (mustProvide("amsbsy"))
packages << "\\usepackage{amsbsy}\n";
if (mustProvide("amstext"))
packages << "\\usepackage{amstext}\n";
}
// wasysym is a simple feature, but it must be after amsmath if both

View File

@ -1659,17 +1659,18 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
return success_;
}
docstring rem;
cmd = Encodings::fromLaTeXCommand(cmd, rem);
for (size_t i = 0; i < cmd.size(); ++i)
cell->push_back(MathAtom(new InsetMathChar(cmd[i])));
if (rem.size()) {
MathAtom at = createInsetMath(t.cs());
cell->push_back(at);
MathData ar;
if (!mathed_parse_cell(ar, '{' + rem + '}', mode_))
success_ = false;;
cell->append(ar);
}
do {
cmd = Encodings::fromLaTeXCommand(cmd, rem);
for (size_t i = 0; i < cmd.size(); ++i)
cell->push_back(MathAtom(new InsetMathChar(cmd[i])));
if (rem.size()) {
char_type c = rem[0];
cell->push_back(MathAtom(new InsetMathChar(c)));
cmd = rem.substr(1);
rem.clear();
} else
cmd.clear();
} while (cmd.size());
}
else if (t.cs().size()) {

View File

@ -49,6 +49,9 @@ What's new
- Quotes in InsetListings are now plain quotes, rather than InsetQuote
entries (bug 5782).
- Improved re-import from LaTeX of documents containing unadorned unicode
symbols in math.
* USER INTERFACE