Use xfrac package for "fraction characters".

The xfrac package is the "state of the art" for "split-level" (nice) fractions.
Character replacements look consistent, scale properly and fit in the line.

Fixes #5220.
This commit is contained in:
Günter Milde 2016-12-18 23:41:43 +01:00
parent 920f4eb50d
commit 7b5de36a75
3 changed files with 86 additions and 90 deletions

View File

@ -86,7 +86,7 @@
2100 ℀ ℁
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -97,7 +97,7 @@ status collapsed
℅ ℆ ℉
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -113,7 +113,7 @@ status collapsed
2110
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -124,7 +124,7 @@ status collapsed
№ ℗ ℘
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -140,7 +140,7 @@ status collapsed
2120 ℠
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -151,7 +151,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -162,7 +162,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -211,7 +211,7 @@ textgreek (or setting to Greek or loading the textalpha package) to get
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -222,7 +222,7 @@ status collapsed
K Å
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -238,7 +238,7 @@ status collapsed
2130
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -249,7 +249,7 @@ status collapsed
ℵ ℶ ℷ ℸ
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
℺ ℻ ℼ ℾ ℿ
@ -265,7 +265,7 @@ status collapsed
2140
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -276,7 +276,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
⅂ ⅃
@ -287,7 +287,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -298,7 +298,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -309,7 +309,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
ⅎ ⅏
@ -326,18 +326,9 @@ status collapsed
\begin_layout Labeling
\labelwidthstring 00.00.0000
2150 ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ ⅟
2150 ⅐ ⅑ ⅒ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ ⅟
\end_layout
\begin_deeper
\begin_layout Labeling
\labelwidthstring 00.00.0000
TODO: use
\backslash
sfrac (see #5220)
\end_layout
\end_deeper
\begin_layout Labeling
\labelwidthstring 00.00.0000
2160 Ⅱ Ⅲ Ⅳ Ⅵ Ⅶ Ⅷ Ⅸ Ⅺ Ⅻ
@ -353,7 +344,7 @@ sfrac (see #5220)
2180
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
ↀ ↁ ↂ Ↄ ↄ ↅ ↆ ↇ ↈ ↉ ↊ ↋ ↌ ↍ ↎ ↏
@ -373,7 +364,7 @@ status collapsed
2190 ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↚ ↛
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -384,7 +375,7 @@ status collapsed
↝ ↞
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -400,7 +391,7 @@ status collapsed
21A0 ↠
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -411,7 +402,7 @@ status collapsed
↢ ↣ ↤
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -422,7 +413,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -438,7 +429,7 @@ status collapsed
21B0 ↰ ↱
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
↲ ↳ ↴
@ -449,7 +440,7 @@ status collapsed
↵ ↶ ↷
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
↸ ↹
@ -465,7 +456,7 @@ status collapsed
21C0 ⇀ ⇁ ⇂ ⇃ ⇄
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -481,7 +472,7 @@ status collapsed
21D0 ⇐ ⇑ ⇒ ⇓ ⇔ ⇕
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
⇖ ⇗ ⇘ ⇙
@ -492,7 +483,7 @@ status collapsed
⇚ ⇛
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -508,7 +499,7 @@ status collapsed
21E0 ⇠
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -519,7 +510,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -530,7 +521,7 @@ status collapsed
⇤ ⇥
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
⇦ ⇧
@ -541,7 +532,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
@ -552,7 +543,7 @@ status collapsed
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
⇫ ⇬ ⇭ ⇮ ⇯
@ -568,7 +559,7 @@ status collapsed
21F0
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard
⇰ ⇱ ⇲ ⇳ ⇴ ⇵ ⇶ ⇷ ⇸ ⇹ ⇺ ⇻ ⇼
@ -579,7 +570,7 @@ status collapsed
⇽ ⇾
\begin_inset Branch na
inverted 0
status collapsed
status open
\begin_layout Standard

View File

@ -81,9 +81,9 @@
0x00b9 "\\textonesuperior" "textcomp" "force" "{{}^1}" "" # ¹ SUPERSCRIPT ONE
0x00ba "\\textordmasculine" "textcomp" "" # MASCULINE ORDINAL INDICATOR
0x00bb "\\guillemotright" "" "force=armscii8" # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0x00bc "\\textonequarter" "textcomp" "" "\\frac14" "" # 1/4 FRACTION
0x00bd "\\textonehalf" "textcomp" "" "\\frac12" "" # 1/2 FRACTION
0x00be "\\textthreequarters" "textcomp" "" "\\frac34" "" # 3/4 FRACTION
0x00bc "\\textonequarter" "textcomp" "" "\\sfrac{1}{4}" "xfrac" # 1/4 FRACTION
0x00bd "\\textonehalf" "textcomp" "" "\\sfrac{1}{2}" "xfrac" # 1/2 FRACTION
0x00be "\\textthreequarters" "textcomp" "" "\\sfrac{3}{4}" "xfrac" # 3/4 FRACTION
0x00bf "\\textquestiondown" "" "" # INVERTED QUESTION MARK
0x00c0 "\\`{A}" "" "mathalpha" "\\grave{A}" # LATIN CAPITAL LETTER A WITH GRAVE
0x00c1 "\\'{A}" "" "mathalpha" "\\acute{A}" # LATIN CAPITAL LETTER A WITH ACUTE
@ -1851,22 +1851,16 @@
0x20b1 "\\textpeso" "textcomp" "force=utf8x" # PESO SIGN
0x20b2 "\\textguarani" "textcomp" "force=utf8;utf8x" # GUARANI SIGN
0x20b9 "\\rupee" "tfrupee" "" "" "" # INDIAN RUPEE SIGN
#
# 74 Letterlike Symbols
#
# use the following macro for the character ACCOUNT OF
0x2100 "\\LyXaccountof"
"\\newcommand*\\LyXaccountof{\\mbox{\\raisebox{.8ex}{a}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{c}}}" "force=utf8;utf8x"
# use the following macro for the character ADRESSED TO THE SUBJECT
0x2101 "\\LyXaddressed" "\\newcommand*\\LyXaddressed{\\mbox{\\raisebox{.8ex}{a}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{s}}}" "force=utf8;utf8x"
0x2100 "\\smallLetterFrac{a}{c}" "smallLetterFrac" "force=utf8;utf8x" "" ""# ACCOUNT OF
0x2101 "\\smallLetterFrac{a}{s}" "smallLetterFrac" "force=utf8;utf8x" "" ""# ADRESSED TO THE SUBJECT
0x2102 "" "" "force=utf8" "\\mathbb{C}" "amssymb" # DOUBLE-STRUCK CAPITAL C
0x2103 "\\textcelsius" "textcomp" "force=utf8x" "" "" # DEGREE CELSIUS
#0x2104 "" "" "" "" "" # CENTRE LINE SYMBOL
# use the following macro for the character CARE OF
0x2105 "\\LyXcareof" "\\newcommand*\\LyXcareof{\\mbox{\\raisebox{.8ex}{c}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{o}}}" "force=utf8;utf8x"
# use the following macro for the character CADA UNA
0x2106 "\\LyXcadauna" "\\newcommand*\\LyXcadauna{\\mbox{\\raisebox{.8ex}{c}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{u}}}" "force=utf8;utf8x"
0x2105 "\\smallLetterFrac{c}{o}" "smallLetterFrac" "force=utf8;utf8x" "" "" # CARE OF
0x2106 "\\smallLetterFrac{c}{u}" "smallLetterFrac" "force=utf8;utf8x" "" "" # CADA UNA
#0x2107 "" "" "" "" "" # EULER CONSTANT
#0x2108 "" "" "" "" "" # SCRUPLE
0x2109 "\\textdegree{}F" "" "force,notermination=text" "" "" # DEGREE FAHRENHEIT
@ -1940,41 +1934,28 @@
#0x214a "" "" "" "" "" # PROPERTY LINE
0x214b "" "" "force=utf8;utf8x" "\\bindnasrepma" "stmaryrd" # TURNED AMPERSAND
#0x214c "" "" "" "" "" # PER SIGN
0x214d "\\LyXaktieselskap" "\\newcommand*\\LyXaktieselskap{\\mbox{\\raisebox{.8ex}{\\footnotesize A}\\kern-.18em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{\\footnotesize S}}}" "force=utf8;utf8x" # ⅍ AKTIESELSKAB
0x214d "\\sfrac{A}{\\kern-.08em S}" "xfrac" "force=utf8;utf8x" "" "" # ⅍ AKTIESELSKAB
#0x214e "" "" "" "" "" # TURNED SMALL F
#0x214f "" "" "" "" "" # SYMBOL FOR SAMARITAN SOURCE
#
# 75 Number Forms
#
#0x2150 "" "" "" "" "" # VULGAR FRACTION ONE SEVENTH
#0x2151 "" "" "" "" "" # VULGAR FRACTION ONE NINTH
#0x2152 "" "" "" "" "" # VULGAR FRACTION ONE TENTH
# use the following macro for the character VULGAR FRACTION ONE THIRD
0x2153 "\\LyXonethird" "\\newcommand*\\LyXonethird{\\mbox{\\raisebox{.8ex}{1}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{3}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION TWO THIRDS
0x2154 "\\LyXtwothirds" "\\newcommand*\\LyXtwothirds{\\mbox{\\raisebox{.8ex}{2}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{3}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION ONE FIFTH
0x2155 "\\LyXonefifth" "\\newcommand*\\LyXonefifth{\\mbox{\\raisebox{.8ex}{1}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{5}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION TWO FIFTHS
0x2156 "\\LyXtwofifths" "\\newcommand*\\LyXtwofifths{\\mbox{\\raisebox{.8ex}{2}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{5}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION THREE FIFTHS
0x2157 "\\LyXthreefifths" "\\newcommand*\\LyXthreefifths{\\mbox{\\raisebox{.8ex}{3}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{5}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION FOUR FIFTHS
0x2158 "\\LyXfourfifths" "\\newcommand*\\LyXfourfifths{\\mbox{\\raisebox{.8ex}{4}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{5}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION ONE SIXTH
0x2159 "\\LyXonesixth" "\\newcommand*\\LyXonesixth{\\mbox{\\raisebox{.8ex}{1}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{6}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION FIVE SIXTHS
0x215a "\\LyXfivesixths" "\\newcommand*\\LyXfivesixths{\\mbox{\\raisebox{.8ex}{5}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{6}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION ONE EIGHT
0x215b "\\LyXoneeight" "\\newcommand*\\LyXoneeight{\\mbox{\\raisebox{.8ex}{1}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{8}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION THREE EIGHTS
0x215c "\\LyXthreeeights" "\\newcommand*\\LyXthreeeights{\\mbox{\\raisebox{.8ex}{3}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{8}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION FIVE EIGHTS
0x215d "\\LyXfiveeights" "\\newcommand*\\LyXfiveeights{\\mbox{\\raisebox{.8ex}{5}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{8}}}" "force=utf8;utf8x"
# use the following macro for the character VULGAR FRACTION SEVEN EIGHTS
0x215e "\\LyXseveneights" "\\newcommand*\\LyXseveneights{\\mbox{\\raisebox{.8ex}{7}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{8}}}" "force=utf8;utf8x"
# use the following macro for the character FRACTION NUMERATOR ONE
0x215f "\\LyXnumeratorone" "\\newcommand*\\LyXnumeratorone{\\mbox{\\raisebox{.8ex}{1}\\kern-.175em\\raisebox{.2ex}{/}\\kern-.18em\\raisebox{-.2ex}{\\kern-.18em}}}" "force=utf8;utf8x"
0x2150 "\\sfrac{1}{7}" "xfrac" "force=utf8;utf8x" "\\sfrac{1}{7}" "xfrac" # VULGAR FRACTION ONE SEVENTH
0x2151 "\\sfrac{1}{9}" "xfrac" "force=utf8;utf8x" "\\sfrac{1}{9}" "xfrac" # VULGAR FRACTION ONE NINTH
0x2152 "\\sfrac{1}{10}" "xfrac" "force=utf8;utf8x" "\\sfrac{1}{10}" "xfrac" # VULGAR FRACTION ONE TENTH
0x2153 "\\sfrac{1}{3}" "xfrac" "force=utf8;utf8x" "\\sfrac{1}{3}" "xfrac" # VULGAR FRACTION ONE THIRD
0x2154 "\\sfrac{2}{3}" "xfrac" "force=utf8;utf8x" "\\sfrac{2}{3}" "xfrac" # VULGAR FRACTION TWO THIRDS
0x2155 "\\sfrac{1}{5}" "xfrac" "force=utf8;utf8x" "\\sfrac{1}{5}" "xfrac" # VULGAR FRACTION ONE FIFTH
0x2156 "\\sfrac{2}{5}" "xfrac" "force=utf8;utf8x" "\\sfrac{2}{5}" "xfrac" # VULGAR FRACTION TWO FIFTHS
0x2157 "\\sfrac{3}{5}" "xfrac" "force=utf8;utf8x" "\\sfrac{3}{5}" "xfrac" # VULGAR FRACTION THREE FIFTHS
0x2158 "\\sfrac{4}{5}" "xfrac" "force=utf8;utf8x" "\\sfrac{4}{5}" "xfrac" # VULGAR FRACTION FOUR FIFTHS
0x2159 "\\sfrac{1}{6}" "xfrac" "force=utf8;utf8x" "\\sfrac{1}{6}" "xfrac" # VULGAR FRACTION ONE SIXTH
0x215a "\\sfrac{5}{6}" "xfrac" "force=utf8;utf8x" "\\sfrac{5}{6}" "xfrac" # VULGAR FRACTION FIVE SIXTHS
0x215b "\\sfrac{1}{8}" "xfrac" "force=utf8;utf8x" "\\sfrac{1}{8}" "xfrac" # VULGAR FRACTION ONE EIGHT
0x215c "\\sfrac{3}{8}" "xfrac" "force=utf8;utf8x" "\\sfrac{3}{8}" "xfrac" # VULGAR FRACTION THREE EIGHTS
0x215d "\\sfrac{5}{8}" "xfrac" "force=utf8;utf8x" "\\sfrac{5}{8}" "xfrac" # VULGAR FRACTION FIVE EIGHTS
0x215e "\\sfrac{7}{8}" "xfrac" "force=utf8;utf8x" "\\sfrac{7}{8}" "xfrac" # VULGAR FRACTION SEVEN EIGHTS
0x215f "\\sfrac{1}{}" "xfrac" "force=utf8;utf8x" "\\sfrac{1}{}" "xfrac" # FRACTION NUMERATOR ONE
0x2160 "\\mbox{I}" "" "force=utf8;utf8x" # ROMAN NUMERAL ONE
0x2161 "\\mbox{II}" "" "force=utf8;utf8x" # ROMAN NUMERAL TWO
0x2162 "\\mbox{III}" "" "force=utf8;utf8x" # ROMAN NUMERAL THREE

View File

@ -327,6 +327,23 @@ static docstring const textbaltic_def = from_ascii(
"\\DeclareTextCompositeCommand{\\c}{T1}{r}{\\textcommabelow{r}}\n"
"\\DeclareTextCompositeCommand{\\c}{T1}{R}{\\textcommabelow{R}}\n");
// split-level fractions
static docstring const xfrac_def = from_ascii(
"\\usepackage{xfrac}\n");
static docstring const smallLetterFrac_def = from_ascii(
"\\DeclareCollectionInstance{smallLetterFrac}{xfrac}{default}{text}\n"
" {phantom=c, scale-factor=1.0, slash-left-kern=-.05em}\n"
"\\DeclareCollectionInstance{smallLetterFrac}{xfrac}{lmr}{text}\n"
" {slash-symbol-font=ptm, phantom=c, scale-factor=1, slash-left-kern=-.05em}\n"
"\\DeclareCollectionInstance{smallLetterFrac}{xfrac}{lmss}{text}\n"
" {slash-symbol-font=ptm, phantom=c, scale-factor=1, slash-left-kern=-.05em}\n"
"\\DeclareCollectionInstance{smallLetterFrac}{xfrac}{cmr}{text}\n"
" {slash-symbol-font=ptm, phantom=c, scale-factor=1, slash-left-kern=-.05em}\n"
"\\DeclareCollectionInstance{smallLetterFrac}{xfrac}{cmss}{text}\n"
" {slash-symbol-font=ptm, phantom=c, scale-factor=1, slash-left-kern=-.05em}\n"
"\\newcommand{\\smallLetterFrac}[2]{%\n"
" {\\UseCollection{xfrac}{smallLetterFrac}\\sfrac{#1}{#2}}}\n");
static docstring const lyxref_def = from_ascii(
"\\RS@ifundefined{subsecref}\n"
" {\\newref{subsec}{name = \\RSsectxt}}\n"
@ -914,7 +931,7 @@ char const * simplefeatures[] = {
"fixme",
"todonotes",
"forest",
"varwidth"
"varwidth",
};
char const * bibliofeatures[] = {
@ -1273,7 +1290,7 @@ TexString LaTeXFeatures::getMacros() const
macros << lyxarrow_def << '\n';
if (!usePolyglossia() && mustProvide("textgreek")) {
// ensure LGR font encoding is defined also if fontenc is not loaded by LyX
// ensure LGR font encoding is defined also if fontenc is not loaded by LyX
if (params_.font_encoding() == "default")
macros << textgreek_LGR_def;
macros << textgreek_def << '\n';
@ -1286,7 +1303,7 @@ TexString LaTeXFeatures::getMacros() const
macros << textcyr_def << '\n';
}
// non-standard text accents:
// non-standard text accents:
if (mustProvide("textcommaabove") || mustProvide("textcommaaboveright") ||
mustProvide("textcommabelow") || mustProvide("textbaltic"))
macros << lyxaccent_def;
@ -1303,6 +1320,13 @@ TexString LaTeXFeatures::getMacros() const
if (mustProvide("textbaltic"))
macros << textbaltic_def << '\n';
// split-level fractions
if (mustProvide("xfrac") || mustProvide("smallLetterFrac"))
macros << xfrac_def << '\n';
if (mustProvide("smallLetterFrac"))
macros << smallLetterFrac_def << '\n';
if (mustProvide("lyxmathsym"))
macros << lyxmathsym_def << '\n';