Skip to content

gucio321/matematyka

Repository files navigation

Matematyka

Przed Państwem kod źródłowy mojej strony z notatkami z matematyki. Zapraszam do oglądania i komentowania!

How it works?

  • I write markdown locally (If I need I build it using make html).
  • I commit changes and push them to this repository.
  • First layer of my CI/CD pipeline is triggered by push event. It does the following:
    • some automation happens to put all the source together (include all files in subdirectories of assets/notes). It also updates commit hash/name/date at the bottom of the website.
    • it builds the html content from sphinx project and pushes it to gh-pages branch (this branch has nothing to do with master - it has completely different content).
    • this push triggers the built-in GitHub workflow that does its magic things so that my page hosted via github is updated.
    • the second step of my CI/CD pipeline (parallel to the above) aims to generate a PDF document from the same source. It is also pushed but this time to pdf branch where it could be downloaded via a green scammy-looking button on top of this readme.

Instalacja

Część plików nie jestd dodawana do git'a. Generują się same po użyciu dowolnej komendy z Makefile'a.

python3 -m pip install -m virtualenv # if no virtualenv package already installed
python3 -m virtualenv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
# to build html
make html

Building PDF

On rpm-based linux distros install the following:

dnf install -y latexmk texlive-cmap texlive-collection-fontsrecommended texlive-fncychap texlive-wrapfig texlive-capt-of texlive-framed texlive-upquote texlive-needspace texlive-tabulary texlive-parskip texlive-oberdiek texlive-cancel

on apt-based:

on arch:

  • extra/texlive-binextra
  • texlive-core
  • texlive-bin
  • extra/texlive-latex
  • extra/texlive-latexextra
  • extra/texlive-plaingeneric
  • extra/texlive-langpolish
  • extra/texlive-mathscience

Thing about PDF customization

Start here later

ChatGPT To customize the title page generated by Sphinx when creating a PDF via make latexpdf, you can modify the LaTeX template used for the title page. Sphinx allows you to override the default LaTeX templates by providing your own custom template.

Follow these steps to customize the title page:

Step 1: Locate Sphinx's LaTeX Template Files Find the sphinx directory in your Python installation. You can usually locate it within the site-packages directory of your Python environment.

Inside the sphinx directory, navigate to texinputs.

Step 2: Copy Default Template Locate the sphinxmanual.cls or sphinxhowto.cls file (depending on the type of document you're generating).

Copy this file to your Sphinx documentation project directory. Name the copied file something like custom_sphinxmanual.cls to avoid confusion.

Step 3: Modify the Title Page in the Copied Template Open the copied file (custom_sphinxmanual.cls) in a text editor and find the section related to the title page. It might look something like this:

latex Copy code \renewcommand{\maketitle}{ % Title page contents... } Modify the contents within the \maketitle command to customize the title page. You can change the layout, add or remove elements, or alter formatting as needed.

Step 4: Use the Custom Template In your conf.py file in the Sphinx project directory, add or modify the latex_elements variable to specify the use of the custom template:

python Copy code latex_elements = { 'papersize': 'letterpaper', 'pointsize': '10pt', 'classoptions': ',openany', 'babel': '\usepackage[english]{babel}', 'preamble': '\input{preamble.tex}', 'sphinxsetup': 'VerbatimBorderColor={rgb}{1,1,1}', 'maketitle': '\input{custom_sphinxmanual.cls}', # Use the custom template } Replace 'custom_sphinxmanual.cls' with the name of your custom template file.

Step 5: Generate the PDF Regenerate the documentation using make clean followed by make latexpdf. This will use the modified template to generate the PDF, including the customized title page.

Ensure to adjust the LaTeX commands in the copied file (custom_sphinxmanual.cls) as per your requirements. This method allows you to have full control over the title page layout and contents in your Sphinx-generated PDF.