Open nosuke23 opened 3 years ago
@nosuke23,
I noticed your post on the TeX Stack Exchange and subsequent issues here on GitHub. I'm working on a similar endeavour with the Tikz Plugin for Obsidian using web2js and tikzjax. Have you made any progress on the Dockerfile issue above?
Here's the challenge I'm facing: After compiling core.dump
and tex.wasm
without the {pgfsys-ximera.def}
driver, I ran into an issue where no input.dvi
file was produced in the browser when using the tikjax build:
Error: Could not find file input.dvi
at Module.readFileSync (run-tex.js:20437:8)
at texify (run-tex.js:20936:51)
When running node initex.js
(with the driver), I encountered this error:
This is e-TeX, Version 3.14159265-2.6 (INITEX)
**entering extended mode
LaTeX2e <2018-12-01>
(standalone.cls
Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files stan
dalone
(shellesc.sty
Package shellesc Warning: Shell escape disabled on input line 65.
) (ifluatex.sty) (ifpdf.sty) (ifxetex.sty) (xkeyval.sty (xkeyval.tex
(xkvutils.tex (keyval.tex)))) (standalone.cfg) (article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(size10.clo)))
*(xcolor.sty (color.cfg) (dvips.def) (svgnam.def))
*(tikz.sty (pgf.sty (pgfrcs.sty (pgfutil-common.tex (pgfutil-common-lists.tex))
(pgfutil-latex.def (everyshi.sty)) (pgfrcs.code.tex (pgf.revision.tex)))
(pgfcore.sty (graphicx.sty (graphics.sty (trig.sty) (graphics.cfg)))
(pgfsys.sty (pgfsys.code.tex (pgfkeys.code.tex (pgfkeysfiltered.code.tex))
(pgf.cfg) (pgfsys-ximera.def
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.10 \ProvidesFileRCS $H
eader: /cvsroot/pgf/pgf/generic/pgf/systemlay...
?
Below is my Dockerfile attempt, aiming to encapsulate the necessary steps:
FROM debian:buster
RUN apt-get update
# Add NodeSource repository for Node 12 as that's what was originally used
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
# Essential packages
RUN apt-get install -y curl ca-certificates build-essential \
libkpathsea6 libkpathsea-dev texlive-latex-base texlive-latex-extra \
gzip python2.7 git nodejs
# Clean up
RUN apt-get -y autoclean && rm -rf /var/lib/apt/lists/*
# Set python2.7 as default python for node packages
RUN rm -f /usr/bin/python && ln -s /usr/bin/python2.7 /usr/bin/python
# Clone the git repos
RUN git clone --branch ww-modifications https://github.com/drgrice1/web2js.git /app/web2js
RUN git clone --branch ww-modifications https://github.com/drgrice1/tikzjax.git /app/tikzjax
RUN git clone --branch ww-modifications https://github.com/drgrice1/dvi2html.git /app/dvi2html
# Build web2js
WORKDIR /app/web2js
RUN npm install
RUN ./node_modules/.bin/jison parser.jison
RUN npm install wasm-opt@1.1.1
RUN npm build
RUN npm run generate-wasm
RUN npx wasm-opt --asyncify --pass-arg=asyncify-ignore-indirect --pass-arg=asyncify-imports@library.reset -O1 out.wasm -o tex.wasm
# Deleting the following line from initex.js fixes the error "Error: ! LaTeX Error: Missing \begin{document}."
RUN sed -i "s|&latex \\\\documentclass[margin=0pt]{standalone}\\\\def\\\\pgfsysdriver{pgfsys-ximera.def}|&latex \\\\documentclass[margin=0pt]{standalone}|g" /app/web2js/initex.js
RUN node initex.js
# Compress the wasm and dump files
RUN gzip tex.wasm
RUN gzip core.dump
# Copy to the tikzjax directory
RUN mv tex.wasm.gz /app/tikzjax
RUN mv core.dump.gz /app/tikzjax
# Build dvi2html separately as it fails when built with tikzjax
WORKDIR /app/dvi2html
RUN npm install
RUN npm run build
# Build tikzjax
WORKDIR /app/tikzjax
# Remove dvi2html from package.json
RUN sed -i '20d' package.json
RUN npm install
# Copy dvi2html to node_modules
RUN cp -r /app/dvi2html node_modules
# RUN npm run devbuild
RUN npm run build
RUN npm run postbuild
CMD [ "/bin/bash" ]
For further details and my continued efforts, check my development branch here.
Any insights or feedback would be immensely appreciated.
web2js
has some dependencies to producecore.dump
. It is hard to setup the local environment, therefore I want the Docker environment.This is my
Dockerfile
but! I can't read TEX.POOL.
error has occurred atnode initex.js
.The following is that log.
This message is sent out from the source file but I don't know what is needed or wrong.
tex.pool
file is certainly exist bytangle
. How can I fix it?