Publish.jl icon indicating copy to clipboard operation
Publish.jl copied to clipboard

BibTeX bibliography for PDF output

Open 0x0f0f0f opened this issue 3 years ago • 11 comments

It'd be very cool to support bibtex citations!

0x0f0f0f avatar May 14 '21 13:05 0x0f0f0f

There's some rudimentary support for this already, implemented in https://github.com/MichaelHatherly/Publish.jl/blob/c03914feac59fc3937a752bc68a69f16d5507736/src/load.jl#L19-L39 but undocumented currently since I'm not yet decided on the final public interface for it. It is something I'd like to finish off, but just requires time to complete mostly.

MichaelHatherly avatar May 14 '21 13:05 MichaelHatherly

wooooohhhh cool! will try it out and let you know!

0x0f0f0f avatar May 14 '21 14:05 0x0f0f0f

I tried with latest commit. In my Package.toml:

[publish]
author = "test"
title = "DRAFT"

[publish.latex]
bibliography = "bibliography.bib"

My bibliography.bib

@article{grant2002principles,
  title={Principles of Programming Languages Version 1.0. 3},
  author={Grant, Mike and Palmer, Zachary and Smith, Scott},
  year={2002}
}
note: this is a BETA release; ask questions and report bugs at https://tectonic.newton.cx/
Running TeX ...
warning: ./sections/calculator.tex:53: Overfull \hbox (169.03484pt too wide) in paragraph at lines 53--53
warning: warnings were issued by the TeX engine; use --print and/or --keep-logs for details.
Running xdvipdfmx ...
Writing `./WPLJ.toc` (685 B)
Writing `./WPLJ.pdf` (33.36 KiB)
Writing `./WPLJ.bcf` (88.40 KiB)
Writing `./WPLJ.run.xml` (2.29 KiB)
Writing `./WPLJ.aux` (1.90 KiB)
Writing `./WPLJ.out` (344 B)
INFO - This is Biber 2.14
INFO - Logfile is './WPLJ.blg'
INFO - Reading './WPLJ.bcf'
ERROR - Error: Found biblatex control file version 3.4, expected version 3.7.
This means that your biber (2.14) and biblatex (3.11) versions are incompatible.
See compat matrix in biblatex or biber PDF documentation.
INFO - ERRORS: 1
┌ Error: An error happened whilst watching files; shutting down. Error was: CompositeException(Any[TaskFailedException(Task (failed) @0x00007fb8ffe49510)])
└ @ LiveServer ~/.julia/packages/LiveServer/N0zZq/src/file_watching.jl:109

0x0f0f0f avatar May 15 '21 09:05 0x0f0f0f

https://github.com/MichaelHatherly/Tectonic.jl/pull/4#issuecomment-841635220

It's not documented anywhere in this package, but the biber and biblatex versions need to be compatible with each other. See "Compatibility matrix" in https://anorien.csc.warwick.ac.uk/mirrors/CTAN/biblio/biber/documentation/biber.pdf. 2.14 and 3.14 go together, and since tectonic itself has not updated it's biblatex version, we need to keep this biber version at 2.14.

Not sure why it's picked up biblatex 3.11... is this with a completely fresh tectonic cache?

MichaelHatherly avatar May 15 '21 10:05 MichaelHatherly

yes. i downgraded biber to 2.11 and it worked, but it'd be cool to have it work out of the box

0x0f0f0f avatar May 16 '21 01:05 0x0f0f0f

What's your package versions for Publish and Tectonic? Tectonic's binaries for biber and tectonic are meant to be compatible without user intervention, you shouldn't have to change things manually. Off a fresh install of Publish 0.8.0 and Tectonic 0.4.1 it builds alright and uses biber 2.14.

julia> pdf("Project.toml", "output")
note: this is a BETA release; ask questions and report bugs at https://tectonic.newton.cx/
Running TeX ...
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Running xdvipdfmx ...
Writing `./pubtest.toc` (202 B)
Writing `./pubtest.aux` (1.21 KiB)
Writing `./pubtest.run.xml` (2.31 KiB)
Writing `./pubtest.out` (42 B)
Writing `./pubtest.bcf` (99.20 KiB)
Writing `./pubtest.pdf` (10.46 KiB)
INFO - This is Biber 2.14
INFO - Logfile is './pubtest.blg'
INFO - Reading './pubtest.bcf'
INFO - Found 0 citekeys in bib section 0
WARN - The file './pubtest.bcf' does not contain any citations!
INFO - Writing './pubtest.bbl' with encoding 'UTF-8'
INFO - Output to ./pubtest.bbl
INFO - WARNINGS: 1
note: this is a BETA release; ask questions and report bugs at https://tectonic.newton.cx/
Running TeX ...
Fontconfig warning: "/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf", line 6: unknown element "reset-dirs"
Rerunning TeX because "pubtest.run.xml" changed ...
Running xdvipdfmx ...
Writing `./pubtest.bcf` (99.20 KiB)
Writing `./pubtest.pdf` (10.69 KiB)
Skipped writing 4 intermediate files (use --keep-intermediates to keep them)
"Project.toml"

MichaelHatherly avatar May 16 '21 06:05 MichaelHatherly

[[Publish]]
deps = ["Base64", "CommonMark", "DataStructures", "FilePathsBase", "FileTrees", "HTTP", "IOCapture", "IterTools", "JSON", "LiveServer", "Logging", "Mustache", "Pkg", "PrettyTables", "Requires", "TOML", "Tectonic"]
git-tree-sha1 = "b302581743a08b5a542bba0beac0300360b51742"
uuid = "f065f642-d108-4f50-8aa5-6749150a895a"
version = "0.8.0"

[[Tectonic]]
deps = ["Pkg"]
git-tree-sha1 = "753a4ae3be7e03ae9c2654b8c98bca8b2c5a51be"
uuid = "9ac5f52a-99c6-489f-af81-462ef484790f"
version = "0.4.1"

0x0f0f0f avatar May 16 '21 11:05 0x0f0f0f

Are you able to find the tectonic cache files? (On linux they're under $USER/.cache/Tectonic.) It just seems as though the biblatex cache hasn't updated to 3.14. Simplest approach may be to just delete the tectonic cache and let it try and redownload stuff, which might fix it.

(Do you have a system-installed tectonic by any chance? That could possibly also have something to do with it.)

MichaelHatherly avatar May 16 '21 11:05 MichaelHatherly

Yes, I do have a system tectonic. I'll try deleting the cache!

$ tectonic -V
Tectonic 0.4.1

0x0f0f0f avatar May 17 '21 06:05 0x0f0f0f

works with packages installed from registry now, thanks!! might be worth to add a note to delete tectonic cache if it was installed in the system before, or to specify a different cache directory for Publish.jl, maybe?

0x0f0f0f avatar May 17 '21 06:05 0x0f0f0f

or to specify a different cache directory for Publish.jl, maybe?

That would be ideal, are you aware of whether that's supported in tectonic or not? Last time I check about that I couldn't find an option to change it from the standard one.

MichaelHatherly avatar May 17 '21 07:05 MichaelHatherly