ReScience / template

Template for article submission

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New template with associated script

rougier opened this issue · comments

Just look at the repository. Thumb up if you like it.

  1. Looks good. 2) Works fine with TeXLive 2016 on my Mac.

I have cloned the template repo and I am trying to use it on my Mac to write my Ten Years Challenge paper. Unfortunately I get very different two errors:
1.) if I simply run make I get an error when converting metadata.yaml to metadata.tex:

./yaml-to-latex.py -i metadata.yaml -o metadata.tex
.../ten-years-challenge-pulsed-drive/article.py:171: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
document = yaml.load(data)
Traceback (most recent call last):
File "./yaml-to-latex.py", line 93, in
content = generate_latex_metadata(filename_in, article)
File "./yaml-to-latex.py", line 50, in generate_latex_metadata
"".format(filename=filename, _=article, abstract=abstract))
AttributeError: 'str' object has no attribute 'name'
make: *** [metadata.tex] Error 1

2.) On the other hand, if I run xelatex article I get an undefined control sequence from line #69 of header.tex:

! Undefined control sequence.
...chive.softwareheritage.org/\codeSWH
/
l.69 ...WH/}{\detokenize\expandafter{\codeSWH}}.}}

The only way I have found to complete compilation is to comment out lines #67-69 of header.tex and run the sequence of commands:

xelatex article
biber article
xelatex article
xelatex article
which, however, does not update metadata.tex with info taken from metadata.yaml.
Any help would be greatly appreciated.

I am running TeX Live 2019 on macOS 10.13/High Sierra.

Oh bad. What is your python version ?
Can you post a minimal non-working metadata.yaml such that I can try to debug the script ?

$ python --version
Python 3.7.6

The metadata.yaml is attached here (zipped, since it seems I can't upload a .yaml file). As you can see there is nothing fancy, I have just filled the proper fields according to the instructions.

metadata.yaml.zip

Python is managed by conda and I have double-checked to have PyYAML installed,

conda list | grep "pyyaml"
pyyaml 5.3 py37h1de35cc_0

If you comment these two lines, this should work but there's definitely a problem with the script.

"\\def \\contactNAME{{{_.contact.name}}}\n"
"\\def \\contactEMAIL{{{_.contact.email}}}\n"

Yes it works better now, but now I get an error when processing header.tex since it does not find the two contact variables.

(./header.tex
(/usr/local/texlive/2019/texmf-dist/tex/latex/microtype/mt-cmr.cfg)
! Undefined control sequence.
l.63 \contactNAME
~(\href{mailto:\contactEMAIL}{\contactEMAIL})

What about filling metadata.tex by hand? I understand that using a yaml file is more elegant, but maybe there is some unnecessary redundancy here...

It's because we're also using the metadata.yaml for producing the bibtex latex that is fed to the website. But yes, in the meantime you can fill metadata.tex manually. I'll try to fix the script.

I have looked into the issue. The problem should be in lines #198-208 of article.py which add the contac author information, provided that the authors:affiliations field in metadata.yaml contains an asterisk (*), used to mark the contact author.
Having a paper with only one author and one affiliation, when reading the instructions in metadata.yaml I didn't realize that I had to add the * anyway. Sorry for the misunderstanding! Now everything works flawlessly.

Maybe, instead of changing the code, it would be much easier to clarify this point in line #11 of metadata.yaml, i.e., that it is necessary to mark one of the authors with the * symbol.

You're right. Can you make a PR?

The PR is ready. Many thanks for the support.