|
727 | 727 | (~a "\\int " (v~ u) "\\ \\textrm{d}" (v~ v))])] ; TODO: only for TeX
|
728 | 728 |
|
729 | 729 | ; applications
|
730 |
| - [(app: f us) (let () |
731 |
| - (define arguments |
732 |
| - (string-append* (add-between (map v~ us) ","))) |
733 |
| - (define head ((output-format-function-symbol) f)) |
734 |
| - (~a head app-left arguments app-right))] |
| 730 | + [(app: f us) (match us |
| 731 | + [(list (list 'paren us ...)) |
| 732 | + (define arguments (apply string-append (add-between (map v~ us) ","))) |
| 733 | + (define head ((output-format-function-symbol) f)) |
| 734 | + (~a head "\\left"app-left arguments "\\right" app-right)] |
| 735 | + [_ |
| 736 | + (define arguments (apply string-append (add-between (map v~ us) ","))) |
| 737 | + (define head ((output-format-function-symbol) f)) |
| 738 | + (~a head app-left arguments app-right)])] |
735 | 739 | [_ (wrap u)]))
|
736 | 740 | (define (t1~ u) ; term 1 aka first term in a sum
|
737 | 741 | (when debugging? (displayln (list 't1 u)))
|
|
1031 | 1035 |
|
1032 | 1036 | [(app: f us) #:when (memq f '(< > ≤ ≥ <= >= Less LessEqual Greater GreaterEqual))
|
1033 | 1037 | (match us [(list u v) (~a (v~ u) (~relop f) (v~ v))])]
|
1034 |
| - [(app: f us) (let () |
1035 |
| - (define arguments |
1036 |
| - (apply string-append (add-between (map v~ us) ","))) |
1037 |
| - (define head ((output-format-function-symbol) f)) |
1038 |
| - (~a head app-left arguments app-right))] |
| 1038 | + [(app: f us) (match us |
| 1039 | + [(list (list 'paren us ...)) |
| 1040 | + (define arguments (apply string-append (add-between (map v~ us) ","))) |
| 1041 | + (define head ((output-format-function-symbol) f)) |
| 1042 | + (~a head "\\left"app-left arguments "\\right" app-right)] |
| 1043 | + [_ |
| 1044 | + (define arguments (apply string-append (add-between (map v~ us) ","))) |
| 1045 | + (define head ((output-format-function-symbol) f)) |
| 1046 | + (~a head app-left arguments app-right)])] |
1039 | 1047 | [_ (display u)
|
1040 | 1048 | (error 'verbose~ (~a "internal error, got: " u))]))
|
1041 | 1049 |
|
|
1201 | 1209 | (check-equal? (tex '(* 2 (up 3 4))) "$2\\begin{pmatrix} 3\\\\4\\end{pmatrix}$")
|
1202 | 1210 | (check-equal? (tex '(+ (* 2 (up 3 4)) (vec b))) "$2\\begin{pmatrix} 3\\\\4\\end{pmatrix}+\\vec{b}$")
|
1203 | 1211 | (check-equal? (tex '(+ (* 2 (up 3 4)) (vec AB))) "$2\\begin{pmatrix} 3\\\\4\\end{pmatrix}+\\overrightarrow{AB}$")
|
| 1212 | + ; explicit paren in a function application means parens using \left and \right |
| 1213 | + (check-equal? (tex '(f (paren x y))) "$f\\left(x,y\\right)$") |
1204 | 1214 | )
|
0 commit comments