55 lines
1.7 KiB
Markdown
55 lines
1.7 KiB
Markdown
# Jupyter notebook to python conversion example!
|
|
|
|
Use to convert a Juypter notebook into an `*.tex` file that can easely be imported!
|
|
|
|
## Requirements
|
|
|
|
- [pandoc](https://pandoc.org/)
|
|
- [python](https://www.python.org/)
|
|
- A latex compiler like miktex or overleaf
|
|
- Optionall install [black\[jupyter\]](https://pypi.org/project/black/)
|
|
|
|
## Jupyter
|
|
Create a jupyter notebook.
|
|
Do your experiments.
|
|
|
|
Headlines will be converted into sections and subsections!
|
|
Register in `listing_conversion.py`. There is a `dict` at the top!
|
|
Use an `*.ipynb` fiel
|
|
Add the `listing_preamble.tex` to support the listings. Please do not modify them.
|
|
|
|
If you want to ensure your code is properly formated install black jupyter with `pip install black[juypter]`.
|
|
|
|
If you want your `pd.DataFrame`s formated like tables display them in jupyter like this:
|
|
|
|
```python
|
|
print(dataframe.to_latex())
|
|
```
|
|
This will be converted to `dataframe` via regex.
|
|
The output will also be formated. Some formating options will work via the `to_latex` function.
|
|
|
|
Execurte the `listing_conversion.py`.
|
|
Input your latex file into your project.
|
|
|
|
Also include the `listing_preamble.tex` before the content starts.
|
|
|
|
Build your document!
|
|
|
|
|
|
|
|
### Prefix section
|
|
You can ignore a prefix section in the `*.ipynb` by adding `# Start here` in a MD section.
|
|
Everithing before the first occurrence of that headline will be dropped. The `#Start here` tag will get lost to.
|
|
This is optional!
|
|
|
|
### Suffix section
|
|
You can ignore a suffix section in the `*.ipynb` by adding `# End here` in a MD section.
|
|
Everithing after the first occurrence of that headline will be dropped. The `# End here` tag will get lost to.
|
|
This is optional!
|
|
|
|
# Contribute
|
|
|
|
Please contribute for additional functionality.
|
|
Support for plots is still missing!
|
|
|