Problems generating pdf/latex from scribble

I'm trying to get started using scribble to replace regular latex in my toolchain. However, I'm having a hard time generating both pdf and latex. I believe the error in both instances is related to the same error about \widebar.

Here's the error I get when I tried to get a pdf from the scribble-generated tex:

This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-05-04>
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/inputenc.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-def/pdftex.def)))
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/iftex.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty))
(/usr/local/texlive/2022/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/pdfescape/pdfescape.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/hycolor/hycolor.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/auxhook/auxhook.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/refcount/refcount.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/gettitlestring/gettitlestring.s
ty (/usr/local/texlive/2022/texmf-dist/tex/latex/kvoptions/kvoptions.sty)))
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2022/texmf-dist/tex/generic/intcalc/intcalc.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/etexcmds/etexcmds.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/puenc.def)
(/usr/local/texlive/2022/texmf-dist/tex/latex/url/url.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/bitset/bitset.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/atbegshi-ltx.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/atveryend-ltx.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty

(/usr/local/texlive/2022/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
))) (/usr/local/texlive/2022/texmf-dist/tex/latex/relsize/relsize.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2022/texmf-dist/tex/generic/mathabx/mathabx.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/mathabx/mathabx.dcl))
(/usr/local/texlive/2022/texmf-dist/tex/latex/wasysym/wasysym.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/newtxmath.sty
`newtxmath' v1.71, 2022/01/16 Math macros based originally on txfonts (msharpe)
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/ifxetex.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/ifluatex.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2022/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2022/texmf-dist/tex/generic/xkeyval/xkvutils.tex)))
(/usr/local/texlive/2022/texmf-dist/tex/latex/oberdiek/centernot.sty)
(/usr/local/texlive/2022/texmf-dist/tex/generic/kastrup/binhex.tex)
amsthm NOT loaded

! LaTeX Error: Command \widebar already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.3155 ...^{{\wide@bar{#1}{0}}}{\wide@bar{#1}{1}}}

?
) (/usr/local/texlive/2022/texmf-dist/tex/latex/base/textcomp.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/framed/framed.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/hyphenat/hyphenat.sty

Package hyphenat Warning: *******************************
(hyphenat)                * You have used the htt option.
(hyphenat)                * You are likely to get many Font Warning messages.
(hyphenat)                * These can usually be ignored.
(hyphenat)                *******************************.

) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/color.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/dvipsnam.def))

Package hyperref Warning: Option `bookmarks' has already been used,
(hyperref)                setting the option has no effect on input line 50.

(/usr/local/texlive/2022/texmf-dist/tex/latex/cjk/texinput/CJK.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/cjk/texinput/mule/MULEenc.sty)
(/usr/local/texlive/2022/texmf-dist/tex/latex/cjk/texinput/CJK.enc))
pltstabular is a modification of stabular
(/usr/local/texlive/2022/texmf-dist/tex/latex/psnfss/t1ptm.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
No file test.aux.
(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/omlntxmi.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/untxexa.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/lmsntxsy.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/lmxntxexx.fd)
(/usr/local/texlive/2022/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2022/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
(/usr/local/texlive/2022/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/local/texlive/2022/texmf-dist/tex/latex/base/t1cmtt.fd)

LaTeX Font Warning: Font shape `T1/cmtt/m/scsl' undefined
(Font)              using `T1/cmtt/m/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/b/n' undefined
(Font)              using `T1/cmtt/m/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/b/it' undefined
(Font)              using `T1/cmtt/b/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/b/sl' undefined
(Font)              using `T1/cmtt/b/it' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/b/scit' undefined
(Font)              using `T1/cmtt/b/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/b/sc' undefined
(Font)              using `T1/cmtt/b/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/bx/sl' undefined
(Font)              using `T1/cmtt/bx/it' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/bx/scit' undefined
(Font)              using `T1/cmtt/bx/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/bx/sc' undefined
(Font)              using `T1/cmtt/bx/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/sbx/sc' undefined
(Font)              using `T1/cmtt/sb/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/sb/n' undefined
(Font)              using `T1/cmtt/m/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/sb/it' undefined
(Font)              using `T1/cmtt/sb/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/sb/sl' undefined
(Font)              using `T1/cmtt/sb/it' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/sb/scit' undefined
(Font)              using `T1/cmtt/sb/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/sb/sc' undefined
(Font)              using `T1/cmtt/sb/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/sbc/sc' undefined
(Font)              using `T1/cmtt/c/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/c/n' undefined
(Font)              using `T1/cmtt/m/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/c/it' undefined
(Font)              using `T1/cmtt/c/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/c/sl' undefined
(Font)              using `T1/cmtt/c/it' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/c/scit' undefined
(Font)              using `T1/cmtt/c/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/c/sc' undefined
(Font)              using `T1/cmtt/c/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/lc/sc' undefined
(Font)              using `T1/cmtt/l/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/l/n' undefined
(Font)              using `T1/cmtt/m/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/l/it' undefined
(Font)              using `T1/cmtt/l/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/l/sl' undefined
(Font)              using `T1/cmtt/l/it' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/l/scit' undefined
(Font)              using `T1/cmtt/l/sc' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/l/sc' undefined
(Font)              using `T1/cmtt/l/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/m/ui' undefined
(Font)              using `T1/cmtt/m/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/bx/ui' undefined
(Font)              using `T1/cmtt/bx/n' instead on input line 450.


LaTeX Font Warning: Font shape `T1/cmtt/m/In' undefined
(Font)              using `T1/cmtt/m/n' instead on input line 450.

(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/ot1minntx.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/wasysym/uwasy.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/untxmia.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/untxsym.fd)
(/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/untxsyc.fd)

LaTeX Warning: No \author given.

[1{/usr/local/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./test.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.


Package rerunfilecheck Warning: File `test.out' has changed.
(rerunfilecheck)                Rerun to get outlines right
(rerunfilecheck)                or use package `bookmark'.

 ){/usr/local/texlive/2022/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/local/t
exlive/2022/texmf-dist/fonts/type1/urw/times/utmr8a.pfb>
Output written on test.pdf (1 page, 14290 bytes).
Transcript written on test.log.

I'm on macOS 12.4, using Racket 8.5 and MacTeX 2022.

There's a discussion of this problem here: recent versions of newtxmath define widebar, breaking scribble output · Issue #324 · racket/scribble · GitHub

To supplement Sam’s cross-reference:

Just today I ran into two other conflicts along those lines.
One was with basic scribble/manual as the module lang,
and the other for a bspoke scribble language (someone’s
package).

I tried to use latex-default-redirect. No luck.

The clean-up script I post in the other thread keeps
growing … and it’s easy to fit into a Makefile or
a racket-invoked latex process.

I'm sorry, what clean-up script are you mentioning? Is it this one?

 scribble --prefix math-prefix.tex   file.tex

See end of message. That's one of the two I wrote today. It should be easy to
modify to your needs (if even necessary).

In one setting, I run it from a Makefile:

mf:
	scribble +m ++style style.tex ++extra table.tex  --latex  proposal.scrbl && \
	racket fix.rkt && \
	pdflatex proposal.tex && \
	open proposal.pdf 

In the other one, I run it from a racket script that invokes LaTeX:

 (define stem.tex ...)
 ...
  (parameterize ([current-directory TARGET])
    [(dynamic-require "fix.rkt" 'main) stem.tex]
    (system (~a "pdflatex " stem.tex))
    (system (format "open ~a.pdf" stem))))

(In this setting I need more processing.)

#lang at-exp racket

(provide
 ;; comment out the latex package commands in TABLE because they interfere with each other 
 main)

;; ---------------------------------------------------------------------------------------------------
(define TABLE
  `[ "packageWasysym"
     "packageTxfonts" ])

(define (main . opt-file)
  (define FILE (and (cons? opt-file) (first opt-file)))
  (displayln " ********************************* FIXING ********************************* ")
  
  (define lines (if FILE (file->lines FILE #:mode 'text) (port->lines)))
  (define next
    (for/list ([line lines])
      (for/fold ([line line]) ([row TABLE])
        (regexp-replace (~a "^\\\\" row) line (~a "%% \\\\" row )))))

  (if FILE
      (with-output-to-file FILE #:exists 'replace (λ () (for-each displayln next)))
      (with-output-to-string (λ () (for-each displayln next)))))

;; ---------------------------------------------------------------------------------------------------
(module+ test 

  (require rackunit)

  (define the-broken-latex-file
    #<< here
\documentclass[11pt]{article}

\newcommand{\packageWasysym}{
  \let\leftmoon\relax \let\rightmoon\relax \let\fullmoon\relax \let\newmoon\relax \let\diameter\relax
  \usepackage[nointegrals]{wasysym}}
% Both newtxmath and mathabx define the \widering command.
% The only reason we choose the newtxmath version is that
% acmart.cls is also using the one from newtxmath.
\newcommand{\packageTxfonts}{
  \let\widering\relax
  \usepackage{newtxmath}}
\newcommand{\packageTextcomp}{\usepackage{textcomp}}
\newcommand{\packageFramed}{\usepackage{framed}}

\packageWasysym
\packageTxfonts
\packageTextcom
\packageFramed

\begin{document}

\title{Broken}
\author{Scribble}

\end{document}

 here
    )

    (define the-fixed-latex-file
    #<< here
\documentclass[11pt]{article}

\newcommand{\packageWasysym}{
  \let\leftmoon\relax \let\rightmoon\relax \let\fullmoon\relax \let\newmoon\relax \let\diameter\relax
  \usepackage[nointegrals]{wasysym}}
% Both newtxmath and mathabx define the \widering command.
% The only reason we choose the newtxmath version is that
% acmart.cls is also using the one from newtxmath.
\newcommand{\packageTxfonts}{
  \let\widering\relax
  \usepackage{newtxmath}}
\newcommand{\packageTextcomp}{\usepackage{textcomp}}
\newcommand{\packageFramed}{\usepackage{framed}}

%% \packageWasysym
%% \packageTxfonts
\packageTextcom
\packageFramed

\begin{document}

\title{Broken}
\author{Scribble}

\end{document}

 here
    )

  (check-equal? (with-input-from-string the-broken-latex-file main) the-fixed-latex-file))