tectonic icon indicating copy to clipboard operation
tectonic copied to clipboard

Tectonic doesn't work with self-created packages

Open carlosala opened this issue 2 years ago • 6 comments

I have a main.tex file, that has a \usepackage{preamble_style} package, twhich is defined in the same folder where main.tex is as a file preamble_style.sty. You can see how is created in this repo

carlosala avatar Jan 17 '22 21:01 carlosala

Thanks for linking the example — this certainly should work, and does most of the time. I'll have to check and see why it's not for you.

pkgw avatar Jan 17 '22 22:01 pkgw

Hi! Any news?

carlosala avatar Feb 04 '22 12:02 carlosala

Sorry, none yet. I've been busy with work and all of my Tectonic time has been going into finishing off a project that's been lingering for way too long I'll tag this as help wanted, and maybe someone else will be able to offer some advice?

pkgw avatar Feb 04 '22 16:02 pkgw

Sorry, none yet. I've been busy with work and all of my Tectonic time has been going into finishing off a project that's been lingering for way too long I'll tag this as help wanted, and maybe someone else will be able to offer some advice?

Don't worry! Thanks for your time! By the moment I'm compiling with latexmk and texlive so it's not a problem for me. Another time, thanks!

carlosala avatar Feb 04 '22 16:02 carlosala

Just browsing through and saw this.

Did a test build with tectonic -X compile main.tex --keep-logs and saw this in stderr

error: preamble_style.sty:19: Undefined control sequence
Writing `main.log` (7.05 KiB)
error: halted on potentially-recoverable error as specified

Which says that there is an undefined command within preamble_style.sty, rather than the file not being able to be loaded at all. Looking at the log...

(subfiles.sty
Package: subfiles 2020/02/14 v1.6 Multi-file projects (package)
 (import.sty
Package: import 2020/01/22  v 6.0
))
! Undefined control sequence.
l.19     \ifSubfilesClassLoaded

Seems like it grabbed an old version of subfiles, the \ifSubfilesClassLoaded was added to subfiles after the bundle was created (default is from 2020): https://github.com/gsalzer/subfiles/commit/e63fd195b40e8b102c1abf88c21bbb067b19e486

related to https://github.com/tectonic-typesetting/tectonic/issues/871 , https://github.com/tectonic-typesetting/tectonic/issues/841 -- seems like keeping the bundle updated is complicated from looking at those and some of the PRs where it was updated. Any help that can be given streamlining the process? Otherwise it seems like it should be possible to specify that CTAN should be used instead, maybe an entry in the Tectonic.toml file like

[doc]
name = 'title'
bundle = 'https://data1.fullyjustified.net/tlextras-2020.0r0.tar'

[[output]]
name = 'title'
type = 'pdf'

[[source]]
name = 'CTAN'
url = 'https://mirrors.ctan.org/macros/latex/contrib/{package}.zip'

[[packages]]
[packages.subpages]
source = 'CTAN'
version = '^2.2'

[packages.otherpackage]
git = 'https://github.com/<user>/<package>/<package>.sty'
version = '>=<hash>'

sneakers-the-rat avatar Mar 11 '22 21:03 sneakers-the-rat

Update the bundle per se isn't the tricky part — the scripts in tectonic-texlive-bundles make the process close to automatic. The tricky part is updating the associated engine implementations, which requires isolating and porting over all of the associated code changes. The vast majority of the bundle content doesn't depend sensitively on the engine details, but some of the core stuff can.

For that reason, I'm a little reluctant to really encourage people to pull packages off of CTAN willy-nilly, but it would be really nice to have some streamlined support along the lines you suggest. I don't see any major technical reason that it can't be done — it would just be a fairly substantial piece of engineering to get all of the downloading, caching, verification, etc. to work in a sensible way. It's not something that I expect to have the time for anytime soon but I'd be happy to help one or more people take a stab at building the infrastructure.

pkgw avatar Mar 22 '22 01:03 pkgw

Hey @carlosala! I'm happy to announce you that your repo compiles properly under tectonic 0.11.0 🎉

Compiling it took a whopping ≈42 seconds total (≈2 minutes when downloading packages). Besides the usual –yet impressive– ≈48 Overfull \vbox and Underfull \hbox, I found something interesting:

! LaTeX Error: Option clash for package xcolor.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.15 \usepackage
              {colortbl} % for colors in tables.
? H
The package xcolor has already been loaded with options:
  []
There has now been an attempt to load it with options
  [usenames,x11names]
Adding the global options:
  ,usenames,x11names
to your \documentclass declaration may fix this.

Removing usenames, x11names from xcolor and adding them to the \documentclass fixed it so I could compile it correctly.

Could you give it a try and let me know if it works in your end? Thx 💛

Neved4 avatar Oct 06 '22 20:10 Neved4

Yes, it looks like it's working! Thanks!

carlosala avatar Oct 07 '22 09:10 carlosala

Thanks to you!

Neved4 avatar Oct 07 '22 12:10 Neved4