Skip to content
Snippets Groups Projects
Commit 0902da44 authored by Timon Idema's avatar Timon Idema
Browse files

Figures / support files forces chapter.

parent d119c97f
No related branches found
No related tags found
No related merge requests found
Showing
with 883 additions and 21 deletions
# Open textbooks demonstration # Open textbooks demonstration
Demonstration of an open textbook made with [Jupyter Books](https://jupyterbook.org/intro.html). Demonstration of an open textbook made with [Jupyter Books](https://jupyterbook.org/intro.html).
\ No newline at end of file
## Installation
To install jupyter books, use pip:
pip install jupyter-book
(For this demo we used version 0.13.0)
## Building a Jupyter Book
To build a jupyter book, run:
jb buid *foldername*
## Structure of your LaTeX document
Your LaTeX document must contain only content; essentially, that's the part you normally put between \begin{document} and \end{document}. I strongly recommend putting the content part in separate files per chapter, as having separate Markdown files per chapter is the easiest way to generate a correct table of contents in the HTML view.
## Including exercises
For the exercises, we use the package sphinx-exercise, which is not included by default, so you also need
pip install sphinx-exercise
(For this demo we used version 0.4.0)
You also need to activate the package in _config.yml,
by adding (under sphinx: extra_extensions:) sphinx_exercise
To make the exercises have lists with letters rather than numbers for the parts of the exercise, add the following custom css to the subfolder _static of your book folder:
```{code}
/* Making list items labeled by letters rather than numbers. */
.exercise.admonition ol {
list-style-type: lower-alpha;
}
```
or manually add the same to exercise.css after your book is built.
Exercises have to be part of a (sub)section called Problems. Exercises are then part of a \begin{enumerate}...\end{enumerate} list, with one problem per item.
To process exercises correctly, *any* exercise that has sub-parts must be in a separate file, included via an \input{} in your LaTeX document. You can (recommended, not necessary) also include a separate file with all problems via a single \input{} statement after \section{Problems}, i.e.
```{code}
\section{Problems}
\input{path/to/your/problemsfile}
```
*TODO* exclude solutions.
\ No newline at end of file
...@@ -26,18 +26,33 @@ bibtex_bibfiles: ...@@ -26,18 +26,33 @@ bibtex_bibfiles:
# Sphinx, for html formatting. Needs checking version. # Sphinx, for html formatting. Needs checking version.
# Mathjax config allows us to define tex macros. Note that we need to escape the \ in a latex math command with an extra \. # Mathjax config allows us to define tex macros. Note that we need to escape the \ in a latex math command with an extra \.
# I have no idea what the html_js_files link does (TODO!). See https://cdnjs.com/libraries/require.js and https://cdnjs.cloudflare.com
# Unfortunately, the mathjax3_config loader options break (!) mathjax for markdown files that have a jupytext yaml block. But not loading prevents us from using the physics or boldmatch packages. Clearly this is a bug, needs reporting.
# The bibtex_reference_style is 'Use numeric reference labels, citations are sorted by order of appearance.' Alternatives include alpha, plain, and unsrtalpha. See https://jupyterbook.org/en/stable/content/citations.html
# We don't use this option as we go for local references instead, adding them to individual 'chapter' pages.
# The sphinx_proof extension requires installing the sphinx-proof package, see https://jupyterbook.org/en/stable/content/proof.html
# Likewise, the sphinx_exercise requires installing the sphinx-exercise package.
sphinx: sphinx:
config: config:
html_js_files: html_js_files:
- https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js - https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js
mathjax3_config: mathjax3_config:
#loader: {load: ['[tex]/ams', '[tex]/physics', '[tex]/boldsymbol']}
loader: {load: ['[tex]/autoload', '[tex]/ams']}
tex: tex:
packages: {'[+]': ['autoload', 'ams', 'physics', 'boldsymbol']}
tags: 'ams'
macros: macros:
"kB" : "k_\\mathrm{B}" "kB" : "k_\\mathrm{B}"
#"bm" : "\\boldsymbol"
# extra_extensions: #"bm": "\\vb*"
# - sphinx_proof "bm": "\\mathbf"
# - sphinx_exercise "inprod" : "\\innerproduct"
"diff" : "\\pdv"
# bibtex_reference_style: unsrt
extra_extensions:
- sphinx_proof
- sphinx_exercise
# - sphinx_tojupyter # - sphinx_tojupyter
# Parse, for processing LaTeX-style math. See https://jupyterbook.org/en/stable/content/math.html#latex-style-math and https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#syntax-amsmath # Parse, for processing LaTeX-style math. See https://jupyterbook.org/en/stable/content/math.html#latex-style-math and https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#syntax-amsmath
...@@ -46,6 +61,7 @@ parse: ...@@ -46,6 +61,7 @@ parse:
# don't forget to list any other extensions you want enabled, # don't forget to list any other extensions you want enabled,
# including those that are enabled by default! # including those that are enabled by default!
# meaning that we have to explicitly include dollarmath! # meaning that we have to explicitly include dollarmath!
# Colon-fence is to allow for ::: instead of ``` blocks.
- amsmath - amsmath
- dollarmath - dollarmath
...@@ -55,12 +71,13 @@ repository: ...@@ -55,12 +71,13 @@ repository:
# path_to_book: docs # Optional path to your book, relative to the repository root # path_to_book: docs # Optional path to your book, relative to the repository root
branch: master # Which branch of the repository should be used when creating links (optional) branch: master # Which branch of the repository should be used when creating links (optional)
# HTML specific settings # HTML specific settings - see https://jupyterbook.org/en/stable/customize/config.html
# Add GitHub / GitLab buttons to your book # Add GitHub / GitLab buttons to your book
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository # See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
html: html:
favicon: "content/images/favicon.ico" favicon: "content/images/favicon.ico"
use_issues_button: true use_issues_button: true
use_repository_button: true use_repository_button: true
extra_navbar: "" # Will be displayed underneath the left navbar. This setting overrides the default 'powered by Jupyter Book'
comments: comments:
hypothesis: true # Hypothesis for comments hypothesis: true # Hypothesis for comments
/* Making list items labeled by letters rather than numbers. */
.exercise.admonition ol {
list-style-type: lower-alpha;
}
...@@ -8,9 +8,22 @@ parts: ...@@ -8,9 +8,22 @@ parts:
numbered: True # Only applies to chapters in Part 1. numbered: True # Only applies to chapters in Part 1.
chapters: chapters:
- file: content/Exercise_set_1 - file: content/Exercise_set_1
- file: content/labelingtest
- file: content/tensorsprimer
# - file: content/testfile
- caption: Classical mechanics
numbered: True
chapters:
- file: content/mechanicsintro
- file: content/mechanicsforces
- caption: Demonstrating Jupyter notebooks - caption: Demonstrating Jupyter notebooks
numbered: True numbered: True
chapters: chapters:
- file: content/Exercise_set_6 - file: content/Exercise_set_6
- file: content/Basic_animation_demo.ipynb - file: content/Basic_animation_demo.ipynb
- caption: Software
numbered: True
chapters:
- file: content/git
\ No newline at end of file
...@@ -115,8 +115,10 @@ $$ (Boltzmannconstant) ...@@ -115,8 +115,10 @@ $$ (Boltzmannconstant)
Unfortunately, labels don't work yet for amsmath environments, although they do get numbered: Unfortunately, labels don't work yet for amsmath environments, although they do get numbered:
\begin{equation} \begin{equation}
\label{entropy}
S = \kB \log(\Omega). S = \kB \log(\Omega).
\end{equation} \end{equation}
Does \eqref{entropy} now work? It does like this $\eqref{entropy}$!
Let's try if we can do something else: Let's try if we can do something else:
```{math} ```{math}
...@@ -128,6 +130,22 @@ c &= d ...@@ -128,6 +130,22 @@ c &= d
``` ```
Can we now refer to equations {eq}`block`? Can we now refer to equations {eq}`block`?
We tried loading the physics package, so let's give it a shot:
\begin{equation}
\pdv{f}{x}
\end{equation}
For unclear reasons, the d could just be nicely aligned with the $x$ here, or it could not: Perhaps somewhat confusingly, these basis one-forms are denoted $\mathrm{d}x^i$:
$$
\mathrm{d}x^i(\bm{v}) = v^i.
$$ (defbasisoneform1)
Not aligned. Howe about $\mathrm{d}x$ and $\,\mathrm{d}x$? I don't get it. Just copying now:
$$
\int \limits_{-\infty}^\infty P(x) \dd{x} = 1.
$$ (eq:temp)
(sec:Notes_Central_limit_theorem)= (sec:Notes_Central_limit_theorem)=
## Useful notes and equations ## Useful notes and equations
......
--- ---
jupytext: jupytext:
text_representation: formats: md:myst
extension: .md text_representation:
format_name: myst extension: .md
format_version: 0.13 format_name: myst
jupytext_version: 1.10.3
kernelspec: kernelspec:
display_name: Python 3 (ipykernel) display_name: Python 3 (ipykernel)
language: python language: python
name: python3 name: python3
--- ---
# Phase transitions # Phase transitions
## Nucleation and growth ## Nucleation and growth
...@@ -103,15 +101,14 @@ will skip that discussion for now. ...@@ -103,15 +101,14 @@ will skip that discussion for now.
5. The Gibbs free energy of a solid nucleus is approximated by 5. The Gibbs free energy of a solid nucleus is approximated by
$$ $$
G = 4\pi R^2 \gamma - \frac{4\pi R^3}{3} \Delta G G = 4\pi R^2 \gamma - \frac{4\pi R^3}{3} \Delta p
$$ $$
with $R$ the with $R$ the radius of the nucleus, $\gamma$ the surface tension between the
radius of the nucleus, $\gamma$ the surface tension between the nucleus and the continuum phase, $\Delta p$ the pressure difference across the phase boundary, and $G$ the (free) energy
nucleus and the continuum phase, and $\Delta G$ the (free) energy
difference between the solid and liquid phase. Calculate how large a difference between the solid and liquid phase. Calculate how large a
nucleus needs to grow before it can grow spontaneously, in terms of nucleus needs to grow before it can grow spontaneously, in terms of
$\gamma$ and $\Delta G$. Call the corresponding critical radius $\gamma$ and $\Delta p$. Call the corresponding critical radius
$R_\mathrm{crit}$. $R_\mathrm{crit}$.
## Van der Waals fluids ## Van der Waals fluids
......
File added
# Working with git
## Upload a project from a local file system to GitLab
Source: [Stackoverflow: How to upload project from local file system to GitLab](https://stackoverflow.com/questions/70038069/how-to-upload-project-from-local-file-system-to-gitlab)
1. You have to create a new repository. Use the following command to create an a Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. A .git folder is created in your directory. This folder contains Git records and configuration files. You should not edit these files directly.
```{code}
git init
```
2. If you want to add the files to track with git then you need to usegit add command. if you want to add new or modified or deleted files in the current directory. then add . to select all the files.
```{code}
git add .
```
3. git commit creates a snapshot of the changes made to a Git repository which can then be pushed to the main repository. The -m option of the commit command lets you write the commit message.
```{code}
git commit -m "first commit"
```
4. You add a “remote” to tell Git which remote repository in GitLab is tied to the specific local folder on your computer. The remote tells Git where to push or pull from. You have to create a project to hold your files. **You should create a project in gitlab.that path should be given in the following command.**
```{code}
git remote add origin git@gitlab.com:username/projectpath.git
```
5. Get the changes from the remote with git pull
```{code}
git pull origin master
```
6. Push the commits to the GitLab project
```{code}
git push origin master
```
7. If any problem occurs in pushing use the following command for force push
```{code}
git push --force origin master
```
\ No newline at end of file
File added
File added
File added
content/images/Newton.jpg

413 KiB

File added
File added
File added
File added
File added
File added
File added
content/images/fallingobjects.png

694 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment