ccr-journal / ccr-quarto

Quarto template for CCR
MIT License
8 stars 3 forks source link

Should we support xetex / can we avoid overriding template.tex? #7

Open vanatteveldt opened 1 year ago

vanatteveldt commented 1 year ago

When I added xelatex support, I got a lot of weird math-related errors. Before changing the math font, I got errors on symbols not existing. After adding a math font it clashed with amssymb and unicode-math.

If someone with more (xe)latex expertise can have a look at it that would be great, I didn't really know what I was doing :(

chainsawriot commented 1 year ago

Tag @mscharkow here, he might have an idea.

vanatteveldt commented 1 year ago

@chainsawriot wrote in an email:

In my opinion it is better to fix the pdf-engine so that you'll get consistent output across machines [#6]. For R users, I think pdflatex is slightly better because pdflatex is installed by default using tinytex (the default Tex Engine for Quarto, if one doesn't have texlive installed) but not xetex.

In that case I guess this issue is moot as the problems only occur when using xetex. We should probably then add a warning or error if people do use xetex.

However, isn't xetex a lot better if people want to use non-western fonts? I tried out some things for CJK and arabic/hebrew and I think xetex was a lot easier to get working (e.g. https://www.overleaf.com/6968633113ttxrdscyznym), so that could be a reason for supporting it anyway?

chainsawriot commented 1 year ago

@vanatteveldt

I think it should be like this:

default:

https://github.com/vanatteveldt/ccr-quarto/blob/93b1075424db05e8ec4dbe12492a08013878acf6/_extensions/ccr/_extension.yml#L12-L13

put pdf-engine: pdflatex here. (like plos or #6 )

If one really wants to use xetex at the moment, give instructions on how to do that: override it in the qmd (or until all xetex issues are fixed and make it the default?).

Probably Pareto-optimal.

vanatteveldt commented 1 year ago

I tried putting it there, but didn't seem to work.. I probably put it in the wrong place :~

chainsawriot commented 1 year ago

Given ccr-quarto/_extensions/ccr/_extension.yml is like this

title: Quarto template for Computational Communication Science
author: Wouter van Atteveldt
version: 0.0.1
quarto-required: ">=1.2.0"
contributes:
  formats:
    common:
      toc: false
      filters:
        - ccr.lua
    pdf:
      documentclass: ccr
      pdf-engine: pdflatex
      template: ccrtemplate.tex
      template-partials:
        - partials/before-body.tex
        - partials/title.tex
      format-resources:
        - ccr.cls
    html:
      css: styles.css

And this is a minimal example

mkdir qtest
cat << EOF >> qtest/mini.qmd
---
title: x
author:
- name: Author One
  affiliation:
  - University of Somewhere
abstract: A
keywords: bla, blo
volume: 1
pubnumber: 1
pubyear: 2019
firstpage: 1
shortauthors: One
---

## Quarto
EOF
cp ccr-quarto/aup_logo.pdf qtest/aup_logo.pdf ## fixed in #8, but assumed not fixed
cd qtest
quarto add --no-prompt ../ccr-quarto ## I agree
quarto render mini.qmd --to=ccr-pdf

"It works on my machine."™ And Xetex is my system default.