From b8dbac732825186361e382380f85073c9e31e89f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 13 Apr 2026 22:15:25 +0000 Subject: [PATCH 1/6] Initial plan From 086751634e0983783fadc74160c4686a1b2e730a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 13 Apr 2026 22:20:30 +0000 Subject: [PATCH 2/6] add .qmd vignette with macros table and preview/publish workflows Agent-Logs-Url: https://github.com/d-morrison/macros/sessions/382aa7c9-3613-494f-91a9-416c4f1e4b0f Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com> --- .github/workflows/preview.yml | 65 ++++++++++++++++++++++++ .github/workflows/publish.yml | 39 +++++++++++++++ .gitignore | 2 + _quarto.yml | 21 ++++++++ index.qmd | 76 ++++++++++++++++++++++++++++ macros-table.qmd | 94 +++++++++++++++++++++++++++++++++++ 6 files changed, 297 insertions(+) create mode 100644 .github/workflows/preview.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .gitignore create mode 100644 _quarto.yml create mode 100644 index.qmd create mode 100644 macros-table.qmd diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..6311e45 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,65 @@ +name: Quarto Preview + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + +jobs: + build-deploy: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: | + any::knitr + any::rmarkdown + any::DT + + - name: Render + uses: quarto-dev/quarto-actions/render@v2 + + - name: Deploy PR Preview + id: preview-step + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./_site/ + action: ${{ github.event.action == 'closed' && 'remove' || 'deploy' }} + preview-branch: gh-pages + comment: "false" + + - uses: marocchino/sticky-pull-request-comment@v2 + if: steps.preview-step.outputs.deployment-action == 'deploy' + with: + header: pr-preview + recreate: true + message: | + [PR Preview Action](https://github.com/rossjrw/pr-preview-action) ${{ steps.preview-step.outputs.action-version }} + :---: + :rocket: View preview at ${{ steps.preview-step.outputs.preview-url }} + + - uses: marocchino/sticky-pull-request-comment@v2 + if: steps.preview-step.outputs.deployment-action == 'remove' + with: + header: pr-preview + recreate: true + message: | + [PR Preview Action](https://github.com/rossjrw/pr-preview-action) ${{ steps.preview-step.outputs.action-version }} + :---: + Preview removed because the pull request was closed. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..662ed29 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,39 @@ +on: + workflow_dispatch: + push: + branches: main + +name: Quarto Publish + +jobs: + build-deploy: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: | + any::knitr + any::rmarkdown + any::DT + + - name: Render + uses: quarto-dev/quarto-actions/render@v2 + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: _site/ + clean-exclude: pr-preview/ + force: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..47c274c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.quarto/ +/_site/ diff --git a/_quarto.yml b/_quarto.yml new file mode 100644 index 0000000..9fc539e --- /dev/null +++ b/_quarto.yml @@ -0,0 +1,21 @@ +project: + type: website + +website: + title: "macros" + navbar: + left: + - href: index.qmd + text: Home + - href: macros-table.qmd + text: Macro Reference + +format: + html: + theme: cosmo + toc: true + +execute: + warning: false + message: false + freeze: auto diff --git a/index.qmd b/index.qmd new file mode 100644 index 0000000..d12c535 --- /dev/null +++ b/index.qmd @@ -0,0 +1,76 @@ +--- +title: "macros" +--- + +This repository contains LaTeX macros for mathematical notation used in statistical and regression modeling, originally from the [rme repository](https://github.com/d-morrison/rme). + +## Contents + +- `macros.qmd`: LaTeX macro definitions for use in Quarto documents +- [Macro Reference](macros-table.qmd): Searchable table of all macros + +These macros provide convenient shorthand for common mathematical expressions used in: + +- Probability and statistics +- Regression models (linear, logistic, Poisson, survival analysis) +- Maximum likelihood estimation +- Mathematical notation (vectors, matrices, derivatives, etc.) + +## Using as a Git Submodule + +### Adding the submodule to your project + +From the root of your project repository, run: + +```bash +git submodule add https://github.com/d-morrison/macros.git macros +git commit -m "Add macros submodule" +``` + +This will clone the `macros` repository into a `macros/` subdirectory and record it as a submodule. + +### Cloning a project that already uses this submodule + +When cloning a repository that includes this submodule, initialize and fetch the submodule content with: + +```bash +git clone --recurse-submodules +``` + +Or, if you have already cloned the repository without `--recurse-submodules`: + +```bash +git submodule update --init +``` + +### Updating the submodule + +To pull the latest changes from this repository into your project: + +```bash +git submodule update --remote macros +git commit -m "Update macros submodule" +``` + +### Including the macros in a Quarto document + +In your Quarto document's YAML front matter, reference the `macros.qmd` file using the `include-in-header` or via `_quarto.yml`: + +```yaml +--- +include-in-header: + - macros/macros.qmd +--- +``` + +Or, in a shared `_quarto.yml` configuration file: + +```yaml +format: + html: + include-in-header: + - macros/macros.qmd + pdf: + include-in-header: + - macros/macros.qmd +``` diff --git a/macros-table.qmd b/macros-table.qmd new file mode 100644 index 0000000..c462d9c --- /dev/null +++ b/macros-table.qmd @@ -0,0 +1,94 @@ +--- +title: "Macro Reference" +--- + +This page provides a searchable table of all macros defined in `macros.qmd`. + +```{r} +#| label: parse-macros +#| echo: false + +parse_macros <- function(file_path = "macros.qmd") { + lines <- readLines(file_path, warn = FALSE) + + # Remove HTML comments and blank lines + lines <- grep("^\\s*