Skip to content

Instantly share code, notes, and snippets.

@bollwyvl
Last active September 9, 2022 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bollwyvl/baa252a823cdeb8d5e3421a51d15ed4e to your computer and use it in GitHub Desktop.
Save bollwyvl/baa252a823cdeb8d5e3421a51d15ed4e to your computer and use it in GitHub Desktop.
a jupyterlab latex environment
texlive-xetex
channels:
- conda-forge
- nodefaults
dependencies:
# python 3.11 and lab 4 are about to ramp up, things will take a while to shake down
- python >=3.10,<3.11
- jupyterlab >=3,<4
# labextensions
- jupyterlab-latex
- jupyterlab-lsp
# the tested version of texlab and chktex
- jupyter-lsp-latex
# a more-manageable tex engine for the language server
- tectonic
# maybe some other ones like
- jupyter-lsp-python
% source: https://guides.nyu.edu/LaTeX/sample-document
% This is a simple sample document. For more complicated documents take a look in the exercise tab. Note that everything that comes after a % symbol is treated as comment and ignored when the code is compiled.
\documentclass{article} % \documentclass{} is the first command in any LaTeX code. It is used to define what kind of document you are creating such as an article or a book, and begins the document preamble
\usepackage{amsmath} % \usepackage is a command that allows you to add functionality to your LaTeX code
\title{Simple Sample} % Sets article title
\author{My Name} % Sets authors name
\date{\today} % Sets date for date compiled
% The preamble ends with the command \begin{document}
\begin{document} % All begin commands must be paired with an end command somewhere
\maketitle % creates title using information in preamble (title, author, date)
\section{Hello World!} % creates a section
\textbf{Hello World!} Today I am learning \LaTeX. %notice how the command will end at the first non-alphabet charecter such as the . after \LaTeX
\LaTeX{} is a great program for writing math. I can write in line math such as $a^2+b^2=c^2$ %$ tells LaTexX to compile as math
. I can also give equations their own space:
\begin{equation} % Creates an equation environment and is compiled as math
\gamma^2+\theta^2=\omega^2
\end{equation}
If I do not leave any blank lines \LaTeX{} will continue this text without making it into a new paragraph. Notice how there was no indentation in the text after equation (1).
Also notice how even though I hit enter after that sentence and here $\downarrow$
\LaTeX{} formats the sentence without any break. Also look how it doesn't matter how many spaces I put between my words.
For a new paragraph I can leave a blank space in my code.
\end{document} % This is the end of the document
{
"@krassowski/jupyterlab-lsp:plugin": {
"language_servers": {
"texlab": {
"serverSettings": {
"chktex.onOpenAndSave": true,
"chktex.onEdit": true
}
}
}
}
}
#!/usr/bin/env bash
set -eux
# warm up the cache
tectonic example.tex
# List extensions
jupyter server extension list
jupyter labextension list
# enable the crunchy chktex features
if [ "$NB_USER" = "jovyan" ]; then
mkdir -p $NB_PYTHON_PREFIX/share/jupyter/lab/settings/
cp overrides.json $NB_PYTHON_PREFIX/share/jupyter/lab/settings/
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment