Capture corresponding authors and class metadata cleanly

This commit is contained in:
gloamxun committed 2026-10-20 01:15:02 +08:00
1 parent 5fd5f92bb4
commit 06cc88809e
5 files changed
+40 -8

No files matched your search

+14 -4
View File
@@ -1857,12 +1857,15 @@ pub(super) fn build_positioned_pages(
let mut author_emails = Vec::new();
for author in &model.authors {
let mut runs = author.runs.clone();
if !author.affiliations.is_empty() {
let marks = author
if !author.affiliations.is_empty() || author.corresponding {
let mut marks = author
.affiliations
.iter()
.map(|index| superscript(*index))
.collect::<String>();
if author.corresponding {
marks.push('*');
}
runs.push(Run::plain(marks));
}
for line in measure_positioned_lines(
@@ -1928,8 +1931,15 @@ pub(super) fn build_positioned_pages(
}
if !author_emails.is_empty() {
let email_runs =
vec![Run::plain(format!("E-mail: {}", author_emails.join("; ")))];
let corresponding = model.authors.iter().any(|author| author.corresponding);
let email_runs = vec![Run::plain(if corresponding {
format!(
"*Corresponding author(s). E-mail(s): {}",
author_emails.join("; ")
)
} else {
format!("E-mail: {}", author_emails.join("; "))
})];
for line in measure_positioned_lines(
&email_runs,
base_font_size.saturating_sub(1).max(1),
+11 -3
View File
@@ -2224,7 +2224,9 @@ fn author_frontmatter_primitive(
input: &mut vm::ExecutionInput<CompilerState>,
) -> texlang::prelude::Result<()> {
if let Some(next) = input.unexpanded().next()? {
if !matches!(next.value(), token::Value::Other('*')) {
if matches!(next.value(), token::Value::Other('*')) {
write_event(input, token, FrontendEventKind::MetadataAuthorCorresponding);
} else {
input.unexpanded().back(next);
}
}
@@ -2250,8 +2252,14 @@ fn author_frontmatter_primitive(
fn skip_optional_bracket(
input: &mut vm::ExecutionInput<CompilerState>,
) -> texlang::prelude::Result<()> {
let Some(first) = input.unexpanded().next()? else {
return Ok(());
let first = loop {
let Some(next) = input.unexpanded().next()? else {
return Ok(());
};
if matches!(next.value(), token::Value::Space(_)) {
continue;
}
break next;
};
if !matches!(first.value(), token::Value::Other('[')) {
input.unexpanded().back(first);