Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize Tufte-LaTeX #176

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

chriskgrant
Copy link

@chriskgrant chriskgrant commented Mar 20, 2023

Hi-- I'm a big fan of this LaTeX class, but it seems that it's been a very long time since it's been updated and it didn't seem to work well with modern TeX engines such as LuaLaTeX and XeLaTeX. I've taken a stab at modernizing the Tufte-LaTeX classes, which I hope will keep them usable into the future.

Here are the changes I've made:

  1. Use the iftex package to determine which TeX engine is running;
  2. Fix handling of fonts and letterspacing under LuaLaTeX and XeLaTeX, which was needed to get the class to work with LuaLaTeX;
  3. Substitute biblatex and biber for natbib/bibtex for making bibliographies; this involved breaking the optional vertical offset argument of the re-defined \cite command, as I couldn't figure out how to get it to work with biblatex;
  4. Add a Makefile for easy testing and installation of the classes.
  5. Under XeLaTeX or LuaLaTeX, use the ETbb typeface (from the etbb package) as the default main font, if it's installed, and TeX Gyre Pagella if not.

I'm new to this, so I'd certainly welcome any feedback.

As natbib and bibtex are not maintained and can't handle
UTF-8 input, the Tufte-LaTeX class should use biblatex and
biber instead.

Note, however, that this change breaks the vertical offset
argument of the `\cite` command due to how biblatex handles
that command. This may cause problems with citations running
off the bottom of the pages; but since pure-citation sidenotes
are likely to be relatively short, this seems like an acceptable
loss.

Ref Tufte-LaTeX#60.
@gbelanger
Copy link

Amazing work!!

@andrewufrank
Copy link

I have tried to build a fork with most unmerged pull requests. unfortunately this pull request which i would like very much to integrate causes conflicts with other patches I have integrated.
my partially update repository is git@github.com:andrewufrank/tufte-latex-af.git and your patch is in the branch for176. I attempted a merger, but do not understand enough to do it. could you help?
any suggestion to what I should include is welcome!
thank you!
andrew

@chriskgrant
Copy link
Author

Hi @andrewufrank. I based the branch for this pull request off of the master branch, so it would be a lot of work to reconcile the commits I've pushed with however many other pull requests you merged first -- and I definitely don't have time to do that 😂. To be honest, this was something of a maintenance pull request that (1) fixed some low-level problems relating to TeX engines and bibliography management, and (2) included a major but non-substantive re-write to fix the code formatting, so you might consider merging this pull request first and then merging in other pull requests with the features you want. But you'll still probably have to address a bunch of conflicts due to the code formatting I did, if nothing else. Good luck!

@andrewufrank
Copy link

Thank you for your work and the advice. I started without much knowledge (and still do not have much). I did not understand which patches you had applied.
I will try to merge yours first and then see what else I can merge withot too much trouble. I would like - same as you at that time - to have a few things fixed which are pending a long time.
i will make my patched version available and hope it will be better than the current unmaintained version. are you aware of some other uptodate fork?
Thank for the help!

@iandol
Copy link

iandol commented Nov 13, 2023

@chriskgrant — thanks for your updates, lets hope they can get merged! I wondered if you have views on the following:

  1. \autocite is not working by default although we can use \ExecuteBibliographyOptions{autocite=footnote} — but I wondered if it could be added into the template?
  2. Currently longtable table captions are not compatible with Tufte, any idea if this can be added. There is a hack here though it is fragile: https://tex.stackexchange.com/questions/701043/symmetric-tufte-book-with-longtable-captions

@hvoss49
Copy link

hvoss49 commented Dec 25, 2023

All standard cite styles, which are part of the biblatex package, define \autocite. The user should change this only, if a special package did not depend on one of the standard styles, then it should also define \autocite. If not, it looks like a bug ...

@iandol
Copy link

iandol commented Dec 26, 2023

All standard cite styles, which are part of the biblatex package, define \autocite. The user should change this only, if a special package did not depend on one of the standard styles, then it should also define \autocite. If not, it looks like a bug ...

The reason I raised the issue was that \autocite was being rendered in-text, not in the margin. Pandoc generates citations using \autocite and so Pandoc output was getting in-text citations by default. For Tufte, there is a need to override the default of the citation style, and at least now these are ending up in the margin. @hvoss49 as I am sure you are more knowledgeable, what is the preferred way to make sure biblatex citations always show in the margin?

@hvoss49
Copy link

hvoss49 commented Dec 26, 2023

As far as I can see, tufte doesn't load biblatex itself, which should be done if someone uses

\documentclass[nobib]{tufte-book}

to prevent loading of natbib. In this case the user has to load biblatex himself. For example:

\documentclass[nobib]{tufte-book}
\usepackage[style=authoryear,autocite=footnote]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
...	

It would make more sense if tufte-book itself loads biblatex with the autocite=footnote option and leaves the style setting to the user. Predefining also the style with authoryear makes also sense to me, because the standard style
numeric cannot be used for nearly all humanities subjects.

@chriskgrant
Copy link
Author

chriskgrant commented Dec 27, 2023

@hvoss49 Actually, one of the changes I've made in this PR is to substitute biblatex for natbib/bibtex, so the class will automatically load biblatex (with bibstyle=authoryear and citestyle=authoryear-icomp) unless the nobib option is used. Given this, it makes sense for me for the class to also use autocite=plain for consistency (note that I use plain instead of footnote because I redefined the \cite command to place citations in the margin). What do you think?

However, if someone wanted to use a different citation style, they would have to use the nobib option and then load biblatex with their desired style separately, for example:

\documentclass[nobib]{tufte-book}
\usepackage[style=numeric]{biblatex}
...

I might add a note along these lines in the sample book for documentation purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants