Skip to contents

Produces a formatted title page that includes the paper title, author names with affiliation indices, and an affiliation legend. Optionally adds a note for co-first authors.

Usage

generate_title_page(
  data,
  style = c("default", "APA", "Nature"),
  title = NULL,
  show_degree = FALSE,
  co_first_footnote = TRUE
)

Arguments

data

A data frame containing at least: FirstName, MiddleName, LastName, (optionally) Rank, Correspondence, and one or more Affiliation* columns.

style

A character string specifying the style (e.g., "default", "APA", "Nature").

title

An optional paper title.

show_degree

Logical. If TRUE, include Degree after author names.

co_first_footnote

Logical. If TRUE and Rank is provided, adds a note for co-first authors.

Value

A character string with the formatted title page.

Examples

authors <- data.frame(
  FirstName = c("Alice", "Bob"),
  MiddleName = c("M.", ""),
  LastName = c("Smith", "Johnson"),
  Degree = c("PhD", "MD"),
  Email = c("alice@example.com", "bob@example.com"),
  Rank = c(1, 2),
  Correspondence = c(TRUE, FALSE),
  Affiliation1 = c("University of X, Dept. of Y", "University of X, Dept. of Y"),
  Affiliation2 = c(NA, "Company Z, Research Division"),
  stringsAsFactors = FALSE
)
generate_title_page(authors, style = "default", title = "Example Paper", show_degree = TRUE)
#> [1] "## Example Paper\n\nAlice M. Smith PhD^1^*, Bob Johnson MD^1,2^\n\n1. University of X, Dept. of Y\n\n2. Company Z, Research Division\n\n*Corresponding author(s): alice@example.com"