Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
;; This file:
;;   https://anggtwu.net/MAXIMA/2026-dim-integrate.lisp.html
;;   https://anggtwu.net/MAXIMA/2026-dim-integrate.lisp
;;           (find-angg "MAXIMA/2026-dim-integrate.lisp")
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;;
;; Superseded by:
;;   (find-baf "edrxbox-examples.lisp" "myintegrate")
;;   (find-baf "bad-foundations.lisp" "tex-myintegrate")
;;
;; (defun l () (interactive) (find-angg "MAXIMA/2026-dim-integrate.lisp"))
;; (defun m () (interactive) (find-angg "MAXIMA/2026-dim-integrate.mac"))
;;
;; (find-angg "MAXIMA/2025-displa-tex.lisp" "lazy-nouns")
;; (find-es "maxima" "dim-integrate")
;; (find-es "maxima" "d-hbar")
;; (find-angg "MAXIMA/edrxbox-examples.lisp")
;; (find-angg "MAXIMA/edrxbox-examples.lisp" "underbrace")

(setf (get '$myintegrate 'dimension)
      'dim-$myintegrate)

(defun dim-myintegrate-core (fu &optional u a b has-u has-ab)
  (let* ((ints-box (list :height 3 :depth 2 :width 1 :result '((d-integralsign))))
	 (fu-box   (edrxbox-from-form fu))
	 (d-box    (if has-u  (edrxbox-from-string "d")))
	 (u-box    (if has-u  (edrxbox-from-form u)))
	 (a-box    (if has-ab (edrxbox-from-form a)))
	 (b-box    (if has-ab (edrxbox-from-form b)))
	 (a-y      (if has-ab -3))
	 (b-y      (if has-ab  3))
	 (a-width  (if has-ab (getf a-box :width) 0))
	 (b-width  (if has-ab (getf b-box :width) 0))
	 (ab-width (if has-ab (max a-width b-width) 0))
	 (fu-x     (if has-ab (+ 2 ab-width) 2))
	 (d-x      (if has-u (+ fu-x (getf fu-box :width) 1)))
	 (u-x      (if has-u (+ d-x 1))))
    (edrxboxvars-push-x-y-edrxbox 0    0 ints-box)
    (when has-ab
      (edrxboxvars-push-x-y-edrxbox 1 a-y a-box)
      (edrxboxvars-push-x-y-edrxbox 1 b-y b-box))
    (edrxboxvars-push-x-y-edrxbox fu-x 0 fu-box)
    (when has-u
      (edrxboxvars-push-x-y-edrxbox d-x  0 d-box)
      (edrxboxvars-push-x-y-edrxbox u-x  0 u-box))
    (edrxboxvars-push-x-y-end)))

(defun dim-$myintegrate (form result)
  (let* ((args  (rest   form))
	 (nargs (length args))
	 (fu    (first  args))
	 (u     (second args))
	 (a     (third  args))
	 (b     (fourth args))
	 (alt-a (second args))
	 (alt-b (third args)))
    (cond ((= nargs 1) (run-in-edrxbox-dim (dim-myintegrate-core fu)))
	  ((= nargs 2) (run-in-edrxbox-dim (dim-myintegrate-core fu u nil nil :has-u)))
	  ((= nargs 4) (run-in-edrxbox-dim (dim-myintegrate-core fu u a b :has-u :has-ab)))
	  ((= nargs 3) (run-in-edrxbox-dim (dim-myintegrate-core fu nil alt-a alt-b nil :has-ab)))
	  (t (dimension-function form result)))))

(defprop $myintegrate tex-$myintegrate tex)

(defun tex-$myintegrate (o l r)
  (let* ((args   (rest   o))
	 (nargs  (length args))
	 (fu     (first  args))
	 (u      (second args))
	 (a      (third  args))
	 (b      (fourth args))
	 (alt-a  (second args))
	 (alt-b  (third args))
	 (ab-tex (cond ((= nargs 4) (format nil "_{~a}^{~a}" ($tex1 a) ($tex1 b)))
		       ((= nargs 3) (format nil "_{~a}^{~a}" ($tex1 alt-a) ($tex1 alt-b)))
		       (t " ")))
	 (du-tex (cond ((= nargs 4) (format nil "\\;d~a" ($tex1 u)))
		       ((= nargs 2) (format nil "\\;d~a" ($tex1 u)))
		       (t "")))
	 (int-tex (format nil "\\int~a{~a~a}\\big." ab-tex ($tex1 fu) du-tex)))
  `(,@l
    ,int-tex
    ,@r)))

#|
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
** (find-angg "MAXIMA/2025-emaxima+.mac")
load       ("~/MAXIMA/2025-emaxima.mac");
display2d:true$
to_lisp();
  (load "2026-dim-integrate.lisp")
  (to-maxima)

myintegrate(abc, def);
myintegrate(abc);
myintegrate(abc, def, gh, ij);
myintegrate(abc, def, gh, ij, hj);

o1 : underbrace(g(x), u);
o2 : underbrace(f(o1), f(u));
o3 : underbrace(gp(x), _diff(u,x));
o4 : underbrace(o3 *. dx, du);
o5 : o2 *. o4;
myintegrate(o5);
myintegrate(o5, x=a, x=b);

tex1(myintegrate(f(x)));
tex1(myintegrate(f(x),x));
tex1(myintegrate(f(x),x,a,b));
tex1(myintegrate(f(x)  ,a,b));

|#