Skip to content

Commit eaa6364

Browse files
Update build_preprint.yml
1 parent 443adc8 commit eaa6364

1 file changed

Lines changed: 17 additions & 26 deletions

File tree

.github/workflows/build_preprint.yml

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,31 @@ jobs:
3535
parts = content.split('---\n')
3636
fm = yaml.safe_load(parts[1])
3737
38-
authors = fm.get('authors', [])
38+
authors = fm.get('authors', [])
3939
affiliations = {a['index']: a['name'] for a in fm.get('affiliations', [])}
4040
41-
# ── Pandoc metadata (title + date only; authors handled in title block) ──
41+
# ── Pandoc metadata ───────────────────────────────────────────────────
42+
# Pass hyperref colours and geometry as Pandoc variables so they reach
43+
# the template *before* \usepackage{hyperref} is emitted — avoids the
44+
# option-clash that occurs when loading hyperref a second time in
45+
# --include-in-header.
4246
meta = {
43-
'title': fm.get('title', ''),
44-
'date': str(fm.get('date', '')),
47+
'title': fm.get('title', ''),
48+
'date': str(fm.get('date', '')),
49+
'colorlinks': True,
50+
'linkcolor': 'blue',
51+
'urlcolor': 'blue',
52+
'citecolor': 'blue',
53+
'geometry': 'a4paper, margin=2.5cm',
4554
}
4655
with open('/tmp/pandoc_meta.yaml', 'w') as f:
4756
yaml.dump(meta, f, allow_unicode=True)
4857
49-
# ── Build LaTeX title block ──
58+
# ── LaTeX title block ─────────────────────────────────────────────────
5059
lines = []
5160
lines.append(r'\begin{center}')
5261
lines.append(r'{\LARGE\bfseries ' + fm.get('title','').replace('&', r'\&') + r'}\\[0.8em]')
5362
54-
# Authors with superscript affiliation numbers
5563
author_parts = []
5664
for a in authors:
5765
affs = a.get('affiliation', '')
@@ -65,11 +73,9 @@ jobs:
6573
6674
lines.append(r'\large ' + r',\quad '.join(author_parts) + r'\\[0.5em]')
6775
68-
# Affiliation list
6976
for idx, name in sorted(affiliations.items()):
7077
lines.append(rf'$^{{{idx}}}$\small {name.replace("&", r"&")}\\[0.2em]')
7178
72-
# Corresponding author email
7379
for a in authors:
7480
if a.get('corresponding') and a.get('email'):
7581
lines.append(r'\small $^{*}$Corresponding author: \href{mailto:'
@@ -90,19 +96,8 @@ jobs:
9096
- name: Create LaTeX header
9197
run: |
9298
cat > /tmp/header.tex << 'EOF'
93-
% ── URL / hyperlink handling ──────────────────────────────────────────
94-
\PassOptionsToPackage{hyphens}{url}
99+
% ── URL breaking (loaded AFTER hyperref by Pandoc's template) ─────────
95100
\usepackage{xurl}
96-
\usepackage[
97-
colorlinks=true,
98-
linkcolor=blue,
99-
citecolor=blue,
100-
urlcolor=blue,
101-
breaklinks=true
102-
]{hyperref}
103-
104-
% ── Page geometry ─────────────────────────────────────────────────────
105-
\usepackage[a4paper, margin=2.5cm]{geometry}
106101
107102
% ── Fonts ─────────────────────────────────────────────────────────────
108103
\usepackage{fontspec}
@@ -128,7 +123,6 @@ jobs:
128123
run: |
129124
cd paper
130125
131-
# ── Preprint PDF ──────────────────────────────────────────────────────
132126
pandoc paper.md -o paper.pdf \
133127
--standalone \
134128
--citeproc \
@@ -137,7 +131,6 @@ jobs:
137131
--include-in-header=/tmp/header.tex \
138132
--include-before-body=/tmp/title_block.tex
139133
140-
# ── LaTeX source (self-contained, bibliography embedded) ──────────────
141134
pandoc paper.md -o paper.tex \
142135
--standalone \
143136
--citeproc \
@@ -146,18 +139,16 @@ jobs:
146139
--include-in-header=/tmp/header.tex \
147140
--include-before-body=/tmp/title_block.tex
148141
149-
# ── Preprint submission ZIP ───────────────────────────────────────────
150-
# Append figure paths here if needed, e.g.: figures/fig1.pdf
151142
zip preprint_submission.zip paper.tex
152143
153144
- name: Upload Preprint PDF
154-
uses: actions/upload-artifact@v6
145+
uses: actions/upload-artifact@v7
155146
with:
156147
name: preprint-pdf
157148
path: paper/paper.pdf
158149

159150
- name: Upload Preprint Package
160-
uses: actions/upload-artifact@v6
151+
uses: actions/upload-artifact@v7
161152
with:
162153
name: preprint-package
163154
path: paper/preprint_submission.zip

0 commit comments

Comments
 (0)