bazel-latex icon indicating copy to clipboard operation
bazel-latex copied to clipboard

Add cookingsymbols package

Open Kernald opened this issue 4 years ago • 7 comments

Kernald avatar Feb 08 '21 06:02 Kernald

I can't figure out why the test doesn't build - the only error I get is failed to open file recorder output: [Errno 2] No such file or directory: 'lualatex.fls', which seems to mean there's an error happening earlier, but I have no clue how to see the actual error. Any advice?

Kernald avatar Feb 08 '21 06:02 Kernald

When rebased ontop of #89, we get more details:

kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 cookingsymbols
mktexpk: don't know how to create bitmap font for cookingsymbols.
mktexpk: perhaps cookingsymbols is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.

! error:  (file cookingsymbols) (type 3): font cookingsymbols at 600 not found

I suspect this is what happens:

  • We're missing a tool allowing lualatex to use the font (we have the tfm file), so kpathsea reverts to calling mktexpk to generate another file (not sure what) through mktexpk
  • mktexpk looks for cookingsymbols.mf

This fails because cookingsymbols.mf is part of texmf-dist/fonts/source/public/cookingsymbols, which we don't have access to. While bundling the source maps could be a workaround (I haven't tested this), the proper fix would likely be to understand why the tfm file isn't used in the first place.

@solsjo any suggestion?

Kernald avatar Oct 19 '22 23:10 Kernald

@Kernald, sorry, missed this comment.

No, I'm afraid I don't much information to add.

I did encounter a similar problem, at that time it was related to latex not finding the fontmaps files (*.map) need to produce the font, IIRC.

For me that was related to refactoring messing with the rules and kpathsea lookup. So it should work in the standard case? unless cockingsymbols depend on some package containing some separate font maps?

solsjo avatar Jan 23 '23 00:01 solsjo

@Kernald, I've revisited this one after merging my commits to master.

TL;DR

I managed to reproduce your error, and I've spent some time trying to figure it out. Is the cookingsymbols we reference in the repo fully functional to be used, I don't really know who provides them? But, it seems to me (and I don't have much knowledge of latex, really, really!) that perhaps it is better to generate the mf from the .dtx .ins files? https://ctan.org/pkg/cookingsymbols?lang=en or copy the mf source from here: https://ftp.acc.umu.se/mirror/CTAN/macros/latex/contrib/cookingsymbols/cookingsymbols.pdf, maybe in an additional rule the can produce mf from .dtx .ins, or are, dtx / ins file converted on the fly to mf using \generate directive?

reproducing the error after removing the tool_wrapper

When trying to reproduce the error I noticed that because of the refactoring (not mimicking the TDS structure + latex install structure, but making use of environment variables) we need to do so additional changes.


--- a/latex.bzl
+++ b/latex.bzl
@@ -118,6 +118,7 @@ def get_env(ctx, toolchain, files):
         "SOURCE_DATE_EPOCH": "0",
         "TEXMF": ".",
         "TEXMFCNF": ctx.files.web2c[0].dirname,
+        "WEB2C": ctx.files.web2c[0].dirname,

to find web2c files from scripts, and

--- a/repositories.bzl
+++ b/repositories.bzl
@@ -95,7 +95,11 @@ def latex_repositories(version = TEXLIVE_VERSION_2022):
         download_pkg_archive(bin_build_file, version, path, sha256, patches)
 
     for path, sha256, patches in pkgs.other:
-        download_pkg_archive(other_build_file, version, path, sha256, patches)
+        patch_cmds = []
+        if path.endswith("scripts/texlive") or "web2c" in path:
+            patch_cmds = ["grep -rnl ':$PATH' | xargs sed -i 's#:$PATH#:$(dirname $(dirname $mydir))/$(dirname $(which kpsewhich)):$PATH#g'"]
+
+        download_pkg_archive(other_build_file, version, path, sha256, patches, patch_cmds)

To make the scripts find kpsewhich (some of the scripts execute in a temp-folder instead, but beacuse kpsewhich directory is added to PATH with relative path it only works from the bazel entrypoint) we need to add the path to kpsewhich in the scripts, which themselves appends to the PATH to find their own scripts directory. The hack above simply follows on that. We should probably implement a more solid solution than this.

solsjo avatar Mar 20 '23 06:03 solsjo

I managed to reproduce your error, and I've spent some time trying to figure it out. Is the cookingsymbols we reference in the repo fully functional to be used, I don't really know who provides them? But, it seems to me (and I don't have much knowledge of latex, really, really!) that perhaps it is better to generate the mf from the .dtx .ins files? https://ctan.org/pkg/cookingsymbols?lang=en or copy the mf source from here: https://ftp.acc.umu.se/mirror/CTAN/macros/latex/contrib/cookingsymbols/cookingsymbols.pdf, maybe in an additional rule the can produce mf from .dtx .ins, or are, dtx / ins file converted on the fly to mf using \generate directive?

I'm honestly not sure about any of that - I never dealt with those files before, you clearly have more LaTeX knowledge than I do :-) The only thing that I know is that I didn't have to do any manual work to use cookingsymbols on my LaTeX installation, but I guess the toolchain (outside of Bazel) is smart enough to generate what's needed on the fly.

Kernald avatar Mar 21 '23 21:03 Kernald

Hmm, I read that pdflatex and XeTex does generate e.g. generate tfm files on the fly but not lualatex. Do you remember which program you used?

solsjo avatar Mar 21 '23 21:03 solsjo

I suspect pdflatex, but can't say for certain. Looking for files named *cookingsymbols* on my machine (and excluding any Bazel related ones), I found these:

/home/kernald/.texlive/texmf-var/fonts/pk/ljfour/public/cookingsymbols
/home/kernald/.texlive/texmf-var/fonts/pk/ljfour/public/cookingsymbols/cookingsymbols.657pk
/home/kernald/.texlive/texmf-var/fonts/pk/ljfour/public/cookingsymbols/cookingsymbols.600pk
/home/kernald/.texlive/texmf-var/fonts/pk/ljfour/public/cookingsymbols/cookingsymbols.870pk
/usr/share/texmf-dist/fonts/tfm/public/cookingsymbols
/usr/share/texmf-dist/fonts/tfm/public/cookingsymbols/cookingsymbols.tfm
/usr/share/texmf-dist/fonts/source/public/cookingsymbols
/usr/share/texmf-dist/fonts/source/public/cookingsymbols/cookingsymbols.mf
/usr/share/texmf-dist/tex/latex/cookingsymbols
/usr/share/texmf-dist/tex/latex/cookingsymbols/cookingsymbols.sty

Something did generate those pk files - I'm not sure what, when or how, though.

Kernald avatar Mar 21 '23 21:03 Kernald