# End-to-End Workflow

## Overview

authordown standardizes author metadata and produces common manuscript sections. This vignette uses bundled example data so it can run offline and deterministically.

## Load example data

    library(authordown)

    csv_path <- system.file("extdata", "authordown_template.csv", package = "authordown")
    authors <- authordown_read_local(csv_path)

If you want a fresh template in a temporary file:

    csv_path <- authordown_template()
    authors <- authordown_read_local(csv_path)
    unlink(csv_path)

## Title page

    title_page <- generate_title_page(
      data = authors,
      title = "Example Paper",
      style = "default",
      show_degree = TRUE
    )
    cat(title_page)
    #> ## Example Paper
    #>
    #> Zhipeng Cao PhD^1,2,3^†*, John Snow MD^3,4,5^†*, Harry Potter PhD^2,6,7^, Dolores Abernathy PhD^2,8,9^, Neo Anderson PhD^3,10,11^*, Sheldon Cooper PhD^3,12,13^*
    #>
    #> 1. Neuroverse Research Institute, Shanghai, China
    #>
    #> 2. Quantum Brain Lab, Lunar Base
    #>
    #> 3. Interstellar Data Commons
    #>
    #> 4. Winterfell Institute of Cognitive Resilience
    #>
    #> 5. Northern Clinical Alliance
    #>
    #> 6. Hogwarts School of Mind and Magic
    #>
    #> 7. Ministry of Magic Research Unit
    #>
    #> 8. Westworld Neural Dynamics Lab
    #>
    #> 9. Host Cognition Unit
    #>
    #> 10. Zion Institute for Systems Neuroscience
    #>
    #> 11. Matrix Simulation Lab
    #>
    #> 12. Caltech Theoretical Neuroscience Group
    #>
    #> 13. Geek Physics Lab
    #>
    #> †Co-first authors who contributed equally.
    #>
    #>
    #> *Corresponding author(s): Zhipeng Cao <zhipeng.cao@neuroverse.lab>; John Snow <john.snow@winterfell.north>; Neo Anderson <neo.matrix@zion.free>; Sheldon Cooper <sheldon.cooper@caltech.quark>

## Acknowledgements, conflict, and contributions

    ack <- generate_acknowledgement(authors, style = "paragraph")
    coi <- generate_conflict(authors, style = "paragraph")
    contrib <- generate_contribution(authors, style = "bullets")

    cat(ack)
    #> Acknowledgements: Thanks to the MRI machine for behaving (mostly); Acknowledges the Night's Watch for late-night data collection; Thanks to a helpful owl for delivery of IRB forms; Thanks to the red pill for improving contrast; Acknowledges the host maintenance team for stable uptime; Thanks to a spot on the couch for consistent thinking
    cat("\n\n")
    cat(coi)
    #> The following authors report conflicts of interest: Zhipeng Cao (No conflict, unless rivalry with the autocorrect counts); John Snow (Conflict: sworn oath to scientific neutrality); Harry Potter (Conflict: occasional wand-related artifacts); Neo Anderson (Conflict: occasional mismatch with system administrators); Dolores Abernathy (Conflict: philosophical debates with the control room); Sheldon Cooper (Conflict: mild discomfort with non-optimal protocols).
    cat("\n\n")
    cat(contrib)
    #> - Zhipeng Cao contributed as follows: Neuroimaging wizardry; Pipeline wrangling; Wrote the first draft while coffee was still hot
    #> - John Snow contributed as follows: Kept the cohort organized beyond the wall; Field-tested cold-resistant protocols
    #> - Harry Potter contributed as follows: Magic-to-metric translation; Patronus-level visualization
    #> - Neo Anderson contributed as follows: Reality-bending visualization; Debugged the simulation mid-scan
    #> - Dolores Abernathy contributed as follows: Human-robot interface insights; Memory loop analysis
    #> - Sheldon Cooper contributed as follows: Theoretical framing; Statistical rigor; Fun with p-values

## XLSX input

    xlsx_path <- system.file("extdata", "authordown_template.xlsx", package = "authordown")
    authors_xlsx <- authordown_read_local(xlsx_path)

## Online tables (export to local file first)

If you manage authors in an online table, export it locally and read the file.

1. Export to CSV or XLSX (or TSV).
2. Read locally with `authordown_read_local()`.

Supported formats: CSV, TSV, XLSX.

## Affiliations

Use `Affiliation1`, `Affiliation2`, … `AffiliationN` columns to list all affiliations for each author. There is no hard limit; add as many columns as needed. The title page numbers affiliations in the order they first appear.

## Troubleshooting

- Missing required columns means your input does not include required fields such as `FirstName` and `LastName`.
- Corresponding authors must have an Email means a row has `Corresponding = TRUE` but `Email` is blank.
- ORCID values must match `0000-0000-0000-0000` format.

## Render sections for copy/paste

If you want HTML for clean copy/paste into a manuscript system, use `render_section_html()`:

    html_path <- render_section_html(
      section_title = "Conflict of Interest",
      content_function = generate_conflict,
      data = authors,
      style = "paragraph"
    )