Skip to content

Commit

Permalink
LaTeX Init v0.0.1 replay of precursor repo. (#858)
Browse files Browse the repository at this point in the history
* REPLAY: Added the bare tex document with decoration
* REPLAY: Update .gitignore
* REPLAY: Parameterised Collatz equation
* REPLAY: Collatz conjecture and unique cycle
* REPLAY: Explain 4mod6
* REPLAY: The uniqueness of the cycle starting from 1
* REPLAY: Added subsections
* REPLAY: Refined the discussion of the inverse collatz function
* REPLAY: Added the 'minified versions' of the conjecture
* REPLAY: Updated subsectioning
* REPLAY: Residue classes and their equivalent partitioning
* REPLAY: Explain 10 mod 12
* REPLAY: 4 mod 24 and 16 mod 24 and swapping to ordinals
* REPLAY: DEFINED THE STEPPING FUNCTION 'M(w)'
* REPLAY: Cleanup uniqueness of the cycle starting from 1
* REPLAY: WIP adding initial part of the preemptive values
* REPLAY: Refine the initial requirement for determine the values the preempt descent
* REPLAY: Add more description to preemptive descent and add notes for what to check next
* REPLAY: Replace the previous setup with a simpler one
* Update ignore
* Add force to make clean, add words to devlog, add version on top of doctex
* Readme and devlog
* Workflow
* sudo apt in the latex install
* Try running make pdf in the pandoc latex container
* use substack ubunut identifier
* Add caution in devlog
* Create the LaTeX palette
* Uncomment the latex image in examples
* Use hyperlinks, test different job container
* Try hooking in to a locally defined action to run the make in an img that's installed the required apt packages
* +x the entrypoint
* Add make install to the container
* Try uploading the built pdf
* Add a build workflow
  • Loading branch information
Skenvy authored Jan 13, 2025
1 parent a1366ae commit 8e28111
Show file tree
Hide file tree
Showing 13 changed files with 701 additions and 11 deletions.
153 changes: 153 additions & 0 deletions .github/workflows/LaTeX-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: LaTeX 🟢🎶🐦 Test 🦂 Build 🧱 Release 🚰 and Publish 📦
on:
push:
branches:
- 'main'
paths:
- 'LaTeX/**'
- '!LaTeX/**.md'
- '!LaTeX/.vscode/**'
- '.github/workflows/LaTeX-*'
workflow_dispatch:
permissions: {}
defaults:
run:
shell: bash
working-directory: LaTeX
jobs:
context:
name: GitHub 🐱‍👤 Context 📑
uses: ./.github/workflows/github-context.yaml
# At the moment, the test just builds the pdf. So no need to run it twice.
# test:
# name: LaTeX 🟢🎶🐦 Test 🦂
# permissions:
# actions: read
# contents: read
# security-events: write
# uses: ./.github/workflows/LaTeX-test.yaml
workflow-conditions:
name: 🛑🛑🛑 Stop builds that didn't change the release version 🛑🛑🛑
runs-on: ubuntu-latest
outputs:
version-file-changed: ${{ steps.version-file-check.outputs.version-file-changed }}
version-tag-exists: ${{ steps.version-tag-exists.outputs.version-tag-exists }}
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 2
- name: Check if version files changed
id: version-file-check
run: |
export VERSION_FILE="LaTeX/document.tex"
[ "$(git diff HEAD^1.. --name-only | grep -e "^$VERSION_FILE$")" == "$VERSION_FILE" ] && echo "version-file-changed=${{toJSON(true)}}" >> $GITHUB_OUTPUT || echo "version-file-changed=${{toJSON(false)}}" >> $GITHUB_OUTPUT
- name: Notify on version-file-check
run: echo "::Notice::version-file-changed is ${{ fromJSON(steps.version-file-check.outputs.version-file-changed) }}"
- name: Check if version specified in version file has not released.
id: version-tag-exists
run: |
git fetch --tags
export VER=$(head -1 document.tex | cut -d ' ' -f 3)
[ -z "$(git tag -l "LaTeX-v$VER")" ] && echo "version-tag-exists=${{toJSON(false)}}" >> $GITHUB_OUTPUT || echo "version-tag-exists=${{toJSON(true)}}" >> $GITHUB_OUTPUT
- name: Notify on version-tag-exists
run: echo "::Notice::version-tag-exists is ${{ fromJSON(steps.version-tag-exists.outputs.version-tag-exists) }}"
# Now any step that should only run on the version change can use
# "needs: [workflow-conditions]" Which will yield the condition checks below.
# We want to "release" automatically if "version-file-changed" is true on push
# Or manually if workflow_dispatch. BOTH need "version-tag-exists" is false.
build:
name: LaTeX 🟢🎶🐦 Build 🧱
needs: [workflow-conditions] # test
if: >-
${{ ((fromJSON(needs.workflow-conditions.outputs.version-file-changed) == true && github.event_name == 'push') ||
github.event_name == 'workflow_dispatch') && fromJSON(needs.workflow-conditions.outputs.version-tag-exists) == false }}
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 📄 Docs
uses: ./LaTeX/container
with:
make: pdf
subdirectory: LaTeX
- name: 🆙 Upload pdf
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: pdf
path: LaTeX/document.pdf
if-no-files-found: error
release:
name: LaTeX 🟢🎶🐦 Release 🚰
needs: [build]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 🆒 Download dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: pdf
path: LaTeX/artifact
- name: 🚰 Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >-
export VER=$(head -1 document.tex | cut -d ' ' -f 3) &&
gh release create
LaTeX-v$VER
"artifact/document.pdf#PDF"
--generate-notes
-t "LaTeX: Version $VER"
# publish:
# name: LaTeX 🟢🎶🐦 Publish 📦
# needs: [release]
# runs-on: ubuntu-latest
# steps:
# - name: 🏁 Checkout
# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# - name: 🆒 Download dists
# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
# with:
# name: pdf
# path: LaTeX/artifact
# - ~ publish to arxiv
# docs:
# name: LaTeX 🟢🎶🐦 Docs 📄
# needs: [release, publish]
# permissions:
# contents: write
# runs-on: ubuntu-latest
# steps:
# - name: 🏁 Checkout
# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# - ~ whatever setup is needed here
# - name: 📄 Docs Generation
# run: make docs
# - name: 📄 Docs Publishing
# run: |-
# git config --local user.email "[email protected]"
# git config --local user.name "Github Actions"
# export SHORTSHA=$(git rev-parse --short HEAD)
# git fetch origin gh-pages-LaTeX:gh-pages-LaTeX
# git symbolic-ref HEAD refs/heads/gh-pages-LaTeX
# cd .. && mv LaTeX/docs/build ../MERGE_TARGET
# git rm -rf . && git clean -fxd && git reset
# shopt -s dotglob && mkdir LaTeX && mv ../MERGE_TARGET/* LaTeX/
# git add .
# git commit -m "Build based on $SHORTSHA" --allow-empty
# git push --set-upstream origin gh-pages-LaTeX
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# docs-merge:
# name: GitHub 🐱‍👤 Pages 📄 Merger 🧬
# needs: [docs]
# permissions:
# contents: write
# pages: write
# id-token: write
# uses: ./.github/workflows/github-pages.yaml
# with:
# merge_from: 'gh-pages-LaTeX'
45 changes: 45 additions & 0 deletions .github/workflows/LaTeX-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: LaTeX 🟢🎶🐦 Tests 🦂
on:
push:
branches-ignore:
- 'main'
paths:
- 'LaTeX/**'
- '!LaTeX/**.md'
- '!LaTeX/.vscode/**'
- '.github/workflows/LaTeX-*'
pull_request:
branches:
- 'main'
paths:
- 'LaTeX/**'
- '!LaTeX/**.md'
- '!LaTeX/.vscode/**'
- '.github/workflows/LaTeX-*'
schedule: # 9AM on the 15th
- cron: 0 22 14 1,2,3,10,11,12 * # AEDT Months
- cron: 0 23 14 4,5,6,7,8,9 * # AEST Months
workflow_call:
permissions: {}
defaults:
run:
shell: bash
working-directory: LaTeX
jobs:
pdf:
name: LaTeX 🟢🎶🐦 PDF 📄 Quick Test 🦂
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: 📄 Docs
uses: ./LaTeX/container
with:
make: pdf
subdirectory: LaTeX
- name: 🆙 Upload pdf
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: pdf
path: LaTeX/document.pdf
if-no-files-found: error
3 changes: 2 additions & 1 deletion .meta/banners/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The original is included as well as scripts to generate the modifications, with

## Generate the modifications
The end of `./.meta/banners/modifications/img.py` shows both `recreate_blank_image()` and `recreate_contiguities_map_file()`, and how to use `colour_in_blank_image_with_palette(new_image_path, desired_ratios)`.
Make a venv (I use [these aliases](https://github.com/Skenvy/dotfiles/blob/57638c35a0eb097e3b2a8dc9509b45986ebbc671/.bash_aliases#L34-L35)) and `pip install pillow` then you can `python3 img.py`.

## Where are the modifications?
See them all [here](https://github.com/Skenvy/Collatz/blob/main/.meta/banners/modifications/EXAMPLES.md).
Expand Down Expand Up @@ -81,7 +82,7 @@ We want our palette to be "JavaScript Yellow", "TypeScript Blue", "Node Green",
### Julia
A description of the julia logo and colours can be found at [JuliaLang/julia-logo-graphics](https://github.com/JuliaLang/julia-logo-graphics), or [just the colours graphic](https://raw.githubusercontent.com/JuliaLang/julia-logo-graphics/master/images/julia-colors.svg) which lists "Julia" "Blue" `#4063D8`, "Green" `#389826`, "Purple" `#9558B2`, and "Red" `#CB3C33`, as well as "Royal Blue" `#4169E0`, "Forest Green" `#228B22`, "Medium Orchid" `#B452CD`, and "Brown" (but it's red?) `#CD3333`.
### LaTeX
\#TODO
The [LaTeX Logos Usage](https://www.latex-project.org/about/logos/) site includes the [LaTeX hummingbird logo](https://www.latex-project.org/about/logos/latex-project-logo_288x288.svg). We can download this svg and see the only two non-black / non-white colours are the green of the eye `#37c871` and the teal of the body `#008080`.
### Python
[The python logo](https://www.python.org/community/logos/). We can download one of the svg's and see the yellows, dark `#ffd43b` and light `#ffe873`, and the blues, light `#5a9fd4` and dark `#306998`. There are also 5 greys, from darkest to lightest `#7f7f7f`, `#b2b2b2`, `#b3b3b3`, `#b8b8b8`, `#f4f4f4` (almost white).
### R
Expand Down
2 changes: 0 additions & 2 deletions .meta/banners/modifications/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
<p align="center"><img alt="Banner Image, Collatz Coral" src="https://raw.githubusercontent.com/wiki/Skenvy/Collatz/.meta/banners/modifications/_Julia.png" width=830 height=666/></p>

## LaTeX
``` # TODO
<p align="center"><img alt="Banner Image, Collatz Coral" src="https://raw.githubusercontent.com/wiki/Skenvy/Collatz/.meta/banners/modifications/_LaTeX.png" width=830 height=666/></p>
```

## Python
<p align="center"><img alt="Banner Image, Collatz Coral" src="https://raw.githubusercontent.com/wiki/Skenvy/Collatz/.meta/banners/modifications/_Python.png" width=830 height=666/></p>
Expand Down
19 changes: 14 additions & 5 deletions .meta/banners/modifications/rgba_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@
'Julia Medium Orchid': (180, 82, 205, 255), #B452CD

##### LaTeX #####
# TODO
# The two colours used in the hummingbird logo
'LaTeX Teal': (0, 128, 128, 255), #008080
'LaTeX Green': (55, 200, 113, 255), #37C871
# Slight variations of the main teal that aren't in the logo
'LaTeX Teal Light': (0, 160, 160, 255), #00A0A0
'LaTeX Teal Dark': (0, 96, 96, 255), #006060
'LaTeX Teal Light-Off': (96, 176, 176, 255), #60B0B0
'LaTeX Teal Dark-Off': (32, 80, 80, 255), #205050

##### Python #####
'Python Blue Light': (90, 159, 212, 255), #5a9fd4
Expand Down Expand Up @@ -199,9 +206,11 @@
(1, {_['Julia Blue']: 6, _['Blue']: 3, _['Blue 2']: 1}),
]

# _LATEX_PALETTE = [ # TODO
# (1, {_['COLOUR NAME']: 6}),
# ]
_LATEX_PALETTE = [
(6, {_['LaTeX Teal']: 4, _['LaTeX Green']: 1, }),
(3, {_['LaTeX Teal Light']: 1, _['LaTeX Teal Dark']: 1}),
(1, {_['LaTeX Teal Light-Off']: 1, _['LaTeX Teal Dark-Off']: 1}),
]

_PYTHON_PALETTE = [
(1, {_['Python Yellow Light']: 2, _['Python Yellow Mid']: 6, _['Python Yellow Dark']: 2}),
Expand Down Expand Up @@ -265,7 +274,7 @@
'Java': _JAVA_PALETTE,
'JavaScript': _JAVASCRIPT_PALETTE,
'Julia': _JULIA_PALETTE,
# 'LaTeX': _LATEX_PALETTE, # TODO
'LaTeX': _LATEX_PALETTE,
'Python': _PYTHON_PALETTE,
'R': _R_PALETTE,
'Ruby': _RUBY_PALETTE,
Expand Down
12 changes: 12 additions & 0 deletions LaTeX/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bbl-SAVE-ERROR
*.bcf
*.blg
*-blx.aux
Expand All @@ -42,6 +43,8 @@
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
*.rubbercache
rubber.cache

## Build tool directories for auxiliary files
# latexrun
Expand Down Expand Up @@ -141,6 +144,9 @@ acs-*.bib
*.trc
*.xref

# hypdoc
*.hd

# hyperref
*.brf

Expand Down Expand Up @@ -302,3 +308,9 @@ TSWLatexianTemp*
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib

################################################################################

# More
document.pdf
scans/
12 changes: 11 additions & 1 deletion LaTeX/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
.PHONY: clean test
.PHONY: clean pdf
SHELL:=/bin/bash

clean:
rm -f *.aux
rm -f *.log
rm -f *.toc
rm -f *.pdf

.DEFAULT_GOAL :=
pdf: clean
pdflatex document.tex
39 changes: 37 additions & 2 deletions LaTeX/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
# Collatz: LaTeX
Functions related to the Collatz/Syracuse/3N+1 problem, notes written in LaTeX
# [Collatz](https://github.com/Skenvy/Collatz): [LaTeX](https://github.com/Skenvy/Collatz/tree/main/LaTeX) 🟢🎶🐦
<p align="center"><img alt="Banner Image, Collatz Coral" src="https://raw.githubusercontent.com/wiki/Skenvy/Collatz/.meta/banners/modifications/_LaTeX.png" width=830 height=666/></p>
<sub><p align="center"><i>
<a href="https://github.com/Skenvy/Collatz/blob/main/.meta/banners/README.md">Colourised Collatz Coral</a>; derived from this
<a href="https://twitter.com/Gelada/status/846751901756653568">original by Edmund Harriss</a>
</i></p></sub>

---
[The Collatz/Syracuse/3N+1 problem](https://en.wikipedia.org/wiki/Collatz_conjecture); notes written in [LaTeX](https://www.latex-project.org/).
## Getting Started
The most recent built PDFs should be accessible [in these "LaTeX" releases](https://github.com/Skenvy/Collatz/releases?q=LaTeX&expanded=true).
<!--
I don't know if I'll ever make this high enough quality to consider putting it on
https://arxiv.org/ but that's really the only place this section would be useful for..
[To install the latest from <package-site-name>](<package-website-specific>);
```sh
<installion-command>
```
-->
## Usage
> [!WARNING]
> These are not very well organised notes, reading them probably won't be a lot of fun.
> The formatting isn't even good yet, and many sections are just stubs.
> The writing of the notes is a TODO.
> The current state is just the way that things were years ago when I started on this project.
<!--
This would only be relevant if I was uploading the results to arxiv and added a landing page on this's gh-pages.
## [LaTeX generated pdf](https://skenvy.github.io/Collatz/LaTeX)
-->
## Developing
### The first time setup
```sh
git clone https://github.com/Skenvy/Collatz.git && cd Collatz/LaTeX && make pdf
```
### Iterative development
* `make pdf` to remake the pdf
8 changes: 8 additions & 0 deletions LaTeX/container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:24.04
SHELL ["/bin/bash", "-c"]
RUN apt update && \
apt install -y texlive-latex-base && \
apt install -y texlive-latex-extra && \
apt install -y make
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
20 changes: 20 additions & 0 deletions LaTeX/container/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Skenvy/Collatz internal action -- LaTeX build container'
description: 'Skenvy/Collatz INTERNAL action -- Run a make recipe in a LaTeX build container'
author: 'Nathan Levett'
branding:
icon: 'sunrise'
color: 'purple'
inputs:
make:
description: 'Makefile recipe name'
required: true
subdirectory:
description: "The path to the folder/subdirectory containing the Makefile"
required: false
default: '.'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.make }}
- ${{ inputs.subdirectory }}
5 changes: 5 additions & 0 deletions LaTeX/container/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euxo pipefail

cd "$INPUT_SUBDIRECTORY"
make "$INPUT_MAKE"
Loading

0 comments on commit 8e28111

Please sign in to comment.