Skip to content

Commit

Permalink
Implemented LaTeX-compatible wide tilde and wide hat
Browse files Browse the repository at this point in the history
  • Loading branch information
computacion-marduk committed Apr 26, 2019
1 parent d8ef430 commit e73b4ff
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 deletions TeXmacs/progs/convert/latex/tmtex.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,10 @@
(if (and (string? acc) (string-starts? acc "<wide-"))
(set! acc (string-append "<" (substring acc 6 (string-length acc)))))
(cond ((nstring? acc) arg)
((in? acc '("<hat>" "^")) (list (if wide 'widehat 'hat) arg))
((in? acc '("<tilde>" "~")) (list (if wide 'widetilde 'tilde) arg))
((in? acc '("<hat>" "^")) (list 'hat arg))
((in? acc '("<wide-hat>" "^^")) (list 'widehat arg))
((in? acc '("<tilde>" "~")) (list 'tilde arg))
((in? acc '("<wide-tilde>" "~~")) (list 'widetilde arg))
((== (cadr l) "<wide-bar>") (list 'overline arg))
((== acc "<bar>") (list (if wide 'overline 'bar) arg))
((== acc "<vect>") (list (if wide 'overrightarrow 'vec) arg))
Expand Down
4 changes: 2 additions & 2 deletions TeXmacs/progs/texmacs/keyboard/latex-kbd.scm
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@
("dddot" "Make triple dot" (make-wide "<dddot>"))
("ddddot" "Make quadruple dot" (make-wide "<ddddot>"))
("widecheck" "Make check" (make-wide "<check>"))
("widehat" "Make hat" (make-wide "^"))
("widetilde" "Make tilde" (make-wide "~"))
("widehat" "Make hat" (make-wide "^^"))
("widetilde" "Make tilde" (make-wide "~~"))

("sum" "Insert big summation" (math-big-operator "sum"))
("prod" "Insert big product" (math-big-operator "prod"))
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Convert/Tex/fromtex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2339,8 +2339,8 @@ latex_command_to_tree (tree t) {
return tree (WIDE, l2e (t[1]), "^");
if (is_tuple (t, "\\tilde", 1) || is_tuple (t, "\\Tilde", 1))
return tree (WIDE, l2e (t[1]), "~");
if (is_tuple (t, "\\widehat", 1)) return tree (WIDE, l2e (t[1]), "^");
if (is_tuple (t, "\\widetilde", 1)) return tree (WIDE, l2e (t[1]), "~");
if (is_tuple (t, "\\widehat", 1)) return tree (WIDE, l2e (t[1]), "^^");
if (is_tuple (t, "\\widetilde", 1)) return tree (WIDE, l2e (t[1]), "~~");
if (is_tuple (t, "\\dot", 1) || is_tuple (t, "\\Dot", 1))
return tree (WIDE, l2e (t[1]), "<dot>");
if (is_tuple (t, "\\ddot", 1) || is_tuple (t, "\\Ddot", 1))
Expand Down
3 changes: 2 additions & 1 deletion src/Typeset/Boxes/Composite/math_boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ compute_wide_accent (path ip, box b, string s,
else very_wide= true;
}
else if (!unicode) {
if (s == "^" || s == "<hat>" || s == "~" || s == "<tilde>")
if (request_wide) very_wide = true;
else if (s == "^" || s == "<hat>" || s == "~" || s == "<tilde>")
very_wide= (b->w() >= ((9*fn->wfn) >> 2));
else very_wide= true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Typeset/Concat/concat_math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,9 @@ concater_rep::typeset_wide (tree t, path ip, bool above) {
box b= typeset_as_concat (env, t[0], descend (ip, 0));
string s= env->exec_string (t[1]);
if (s == "^") s= "<hat>";
if (s == "^^") s= "<wide-hat>";
if (s == "~") s= "<tilde>";
if (s == "~~") s= "<wide-tilde>";
bool request_wide= false;
if (starts (s, "<wide-")) {
s= "<" * s (6, N(s));
Expand Down

0 comments on commit e73b4ff

Please sign in to comment.