Skip to content

Instantly share code, notes, and snippets.

@gillescastel
Last active July 9, 2024 17:38
Show Gist options
  • Save gillescastel/7e8a0dc54f62182acde62503b2e8f1d7 to your computer and use it in GitHub Desktop.
Save gillescastel/7e8a0dc54f62182acde62503b2e8f1d7 to your computer and use it in GitHub Desktop.
Phd Workflow
\documentclass[a4paper]{article}
\input{./preamble.tex}
\input{./symbols.tex}
\input{./theorems.tex}
\input{./references.tex}
\usepackage{pgfmath}
\usepackage{pgfcalendar}
\let\d=\pgfcalendarshorthand
\newcommand\formatdate[2]{\pgfcalendar{cal}{#1}{#1}{#2}}
% \newcommand\firstdate{\year-\month-\day+-25}
\newcommand\firstdate{\year-\month-\day+-14}
% \newcommand\firstdate{\year-\month-\day+-50}
% \newcommand\firstdate{2021-11-20}
% \newcommand\firstdate{\year-\month-\day+-41}
\newcommand\lastdate{\year-\month-\day}
\newcommand\grayrule{{\color{gray} \noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}}}
\begin{document}
\begin{center}
\huge{PhD Notes}\\[0.4em]
\Large{Gilles Castel}\\[0.2em]
\emph{
From \formatdate{\firstdate}{\d d- \d mt} to
\formatdate{\lastdate}{\d d- \d mt}
}
\end{center}
\tableofcontents
\bigskip
\pgfcalendar{cal}{\firstdate}{\lastdate}{%
\IfFileExists{./\d y0-\d m0-\d d0/note.tex}{
\ifdate{equals=\firstdate}{}{%
\bigskip
\ifdate{Monday}{\grayrule\\[-22pt]\grayrule}{\grayrule}
}%
\vspace*{1em}
\marginpar{\vspace*{1em}\textsf{ \d w., \d m. \d d- }}%
\addcontentsline{toc}{section}{\d wt, \d d0 \d m.}%
\def\formatteddate{\d{y}0-\d{m}0-\d{d}0}%
\input{./\formatteddate/note.tex}
\ifdate{equals=\lastdate}{}{\hfill \xournal}
}{}
}
\end{document}

Directory structure:

.
├── papers
│   ├── Title - Author.pdf
│   └── Title - Author.pdf
├── notes
│   ├── 2022-04-10
│   │   ├── note.tex
│   │   └── note.xoj
│   ├── 2022-04-11
│   │   ├── note.tex
│   │   └── note.xoj
│   ├── ...
│   ├── master.tex
│   ├── preamble.tex
│   ├── references.tex
│   ├── symbols.tex
│   └── theorems.tex
└── scripts
    ├── ...
    ├── shortcut.sh
    └── template.xoj

Sxhkd config:

# ~/.config/sxhkd/sxhkdrc 

alt + {a-z}
    bash ~/phd/scripts/shortcut.sh {a-z}

This way, any combination of Alt + $KEY calls scripts/shortcut.sh $KEY. This is a bash script with the following shortcuts:

  • Alt + F copies a reference to the currently opened pdf.
  • Alt + N opens the note of today.
  • Alt + O opens the compiled version of my notes.
  • Alt + P allows me to fuzzy search a paper.
  • Alt + R opens my file browser in my phd directory.
  • Alt + X opens today's handwritten notes and if not existing copies the template to today's directory and opens it .

You'll have to edit shortcut a bit to make this work on your system.

\usepackage{cmbright}
% \usepackage{stix}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{mathtools}
\usepackage{tikz-cd}
% figure support
\usepackage{import}
\usepackage[shortlabels]{enumitem}
\usepackage{xifthen}
\pdfminorversion=7
\usepackage{pdfpages}
\usepackage{transparent}
\newcommand{\incfig}[1]{%
\def\svgwidth{\columnwidth}
\import{./figures/}{#1.pdf_tex}
}
\pdfsuppresswarningpagegroup=1
\usepackage{xcolor}
\usepackage{parskip}
\usepackage{soul}
\usepackage{hyperref}
\hypersetup{hidelinks}
\usepackage{fontawesome}
\usepackage{xifthen}% provides \isempty test
\newcommand\pdfref[3]{%
\href{phd://open-paper?id=#1&page=#2}{%
\textup{[\textbf{\ifthenelse{\isempty{#3}}{here}{#3}}]}}%
}
\newcommand\urlref[2]{%
\href{#1}{\raisebox{0.15ex}{\scriptsize \faLink}\:\textup{\textbf{#2}}}%
}
\newcommand\absolutefileref[2]{%
\href{run:#1}{\raisebox{0.15ex}{\scriptsize \faFile}\:\textup{\textbf{#2}}}%
}
% this will contain the current date in yyyy-mm-dd format
\def\formatteddate{}
\newcommand\fileref[2]{
\IfFileExists{./\formatteddate/#1}{
\absolutefileref{./\formatteddate/#1}{#2}
}{
\textcolor{gray}{\absolutefileref{./\formatteddate/#1}{#2}}
}
}
\newcommand{\xournal}{\fileref{note.xoj}{Handwritten notes}}%
#!/bin/bash
root="$(dirname "$(realpath "$0")")"
key="$1"
terminal="x-terminal-emulator -e zsh -i -c"
vim="nvim"
node="/usr/bin/node"
open_xournal () {
cd ~/phd/notes/$(date +"%F");
if [ -f "note.xoj" ]; then
xournal note.xoj;
else
cp ~/phd/scripts/template.xoj note.xoj;
xournal note.xoj;
fi
}
mkdir -p ~/phd/notes/$(date +"%F");
case $key in
p ) cd ~/phd/papers;
pdf_file="$(ls . | rofi -theme ~/.config/rofi/theme-wide.rasi -i -dmenu)";
[ -z "$pdf_file" ] && exit 0;
[ -f "$pdf_file" ] && zathura "$(realpath "$pdf_file")" || sensible-browser "https://google.com/search?q=$pdf_file" ;;
r ) $terminal "ranger ~/phd/notes/$(date +"%F")" ;;
n ) $terminal "cd ~/phd/notes/$(date +"%F"); $vim ~/phd/notes/$(date +"%F")/note.tex" ;;
o ) zathura ~/phd/notes/master.pdf ;;
x ) open_xournal ;;
f ) $node $root/copy-pdf-reference.js ;;
esac
\newcommand{\C}{\mathbb C}
\newcommand{\R}{\mathbb R}
\newcommand{\Q}{\mathbb Q}
\newcommand{\Z}{\mathbb Z}
% ...
This is just an empty Xournal file I've saved.
/**
* User: deadguy
* Copyright: deadguy
*/
configuration {
display-drun: "Open";
display-run: "Run";
display-window: "Window";
show-icons: true;
sidebar-mode: true;
}
* {
font: "Roboto 12";
background-color: #2E3440;
text-color: #E5E9F0;
selbg: #4C566A;
actbg: #242a36;
urgbg: #e53935;
winbg: #E5E9F0;
selected-normal-foreground: @winbg;
normal-foreground: @text-color;
selected-normal-background: @actbg;
normal-background: @background-color;
selected-urgent-foreground: @background-color;
urgent-foreground: @text-color;
selected-urgent-background: @urgbg;
urgent-background: @background-color;
selected-active-foreground: @winbg;
active-foreground: @text-color;
selected-active-background: @actbg;
active-background: @actbg;
line-margin: 2;
line-padding: 2;
separator-style: "none";
hide-scrollbar: "true";
margin: 0;
padding: 0;
}
window {
location: center;
anchor: center;
orientation: horizontal;
children: [mainbox];
width: 60%;
height: 30%;
}
mainbox {
spacing: 0.8em;
children: [ entry,listview ];
}
button { padding: 5px 2px; }
button selected {
background-color: @active-background;
text-color: @background-color;
}
inputbar {
padding: 5px;
spacing: 5px;
}
listview {
spacing: 0.5em;
dynamic: false;
cycle: true;
}
element {
padding: 10px 10px 10px 20px;
}
icon {
margin: 100px;
}
entry {
expand: false;
text-color: @normal-foreground;
vertical-align: 1;
padding: 20px 20px 10px 20px;
}
element normal.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}
element normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
element normal.active {
background-color: @active-background;
text-color: @active-foreground;
}
element selected.normal {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
border: 0 5px solid 0 0;
border-color: @active-background;
}
element selected.urgent {
background-color: @selected-urgent-background;
text-color: @selected-urgent-foreground;
}
element selected.active {
background-color: @selected-active-background;
text-color: @selected-active-foreground;
}
element alternate.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}
element alternate.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
element alternate.active {
background-color: @active-background;
text-color: @active-foreground;
}
\usepackage{mdframed}
\mdfsetup{
leftmargin=-1em,
rightmargin=-1em,
middlelinewidth=1.5pt,
middlelinecolor=white,
innertopmargin=1.5\topskip,
innerbottommargin=1\topskip,
skipabove=\baselineskip,
skipbelow=0,
nobreak=true
}
\newmdenv[
backgroundcolor = red!10
]{wrong}
\newmdenv[
backgroundcolor = green!10
]{correct}
\newmdtheoremenv[linewidth=0]{question}{Question}
\newmdtheoremenv[linewidth=0]{confusion}{Confusion}
\newmdtheoremenv[linewidth=0]{answer}{Answer}
\newmdtheoremenv[]{idea}{Idea}
\newmdtheoremenv[]{claim}{Claim}
\newmdtheoremenv[]{definition}{Definition}
\newmdtheoremenv[]{lemma}{Lemma}
\newmdtheoremenv[linewidth=0]{remark}{Remark}
\newmdtheoremenv[]{theorem}{Theorem}
\newmdtheoremenv[]{corollary}{Corollary}
\newmdtheoremenv[]{problem}{Problem}
\newmdtheoremenv[]{eg}{Example}
\newmdtheoremenv[linewidth=0]{todo}{TODO}
\newmdtheoremenv[backgroundcolor = blue!10, nobreak=false]{marco}{Marco}
\newmdtheoremenv[backgroundcolor=green!5]{mydefinition}{Definition}
\newmdtheoremenv[backgroundcolor=green!5]{mytheorem}{Theorem}
\newmdtheoremenv[backgroundcolor=green!5]{mylemma}{Lemma}
\renewmdenv[
bottomline=false,
topline=false,
rightline=false,
fontcolor=black!70
]{quote}
\newmdenv[fontcolor=black!10, linewidth=0]{ditch}
# Location: ~/.xournal/config.
# Xournal configuration file.
# This file is generated automatically upon saving preferences.
# Use caution when editing this file manually.
#
[general]
# the display resolution, in pixels per inch
display_dpi=96.00
# the initial zoom level, in percent
initial_zoom=176.14
# maximize the window at startup (true/false)
window_maximize=false
# start in full screen mode (true/false)
window_fullscreen=false
# the window width in pixels (when not maximized)
window_width=1411
# the window height in pixels
window_height=1000
# scrollbar step increment (in pixels)
scrollbar_speed=30
# the step increment in the zoom dialog box
zoom_dialog_increment=1
# the multiplicative factor for zoom in/out
zoom_step_factor=1.500
# continuous view (false = one page, true = continuous, horiz = horizontal)
view_continuous=true
# use XInput extensions (true/false)
use_xinput=true
# discard Core Pointer events in XInput mode (true/false)
discard_corepointer=false
# ignore events from other devices while drawing (true/false)
ignore_other_devices=true
# do not worry if device reports button isn't pressed while drawing (true/false)
ignore_btn_reported_up=true
# always map eraser tip to eraser (true/false)
use_erasertip=false
# always map touchscreen device to hand tool (true/false) (requires separate pen and touch devices)
touchscreen_as_hand_tool=false
# disable touchscreen device when pen is in proximity (true/false) (requires separate pen and touch devices)
pen_disables_touch=false
# name of touchscreen device for touchscreen_as_hand_tool
touchscreen_device_name=Touchscr
# buttons 2 and 3 switch mappings instead of drawing (useful for some tablets) (true/false)
buttons_switch_mappings=false
# automatically load filename.pdf.xoj instead of filename.pdf (true/false)
autoload_pdf_xoj=false
# enable periodic autosaves (true/false)
autosave_enabled=false
# delay for periodic autosaves (in seconds)
autosave_delay=5
# default path for open/save (leave blank for current directory)
default_path=/home/gilles/phd/logs/2022-04-10
# use pressure sensitivity to control pen stroke width (true/false)
pressure_sensitivity=false
# minimum width multiplier
width_minimum_multiplier=0.00
# maximum width multiplier
width_maximum_multiplier=1.25
# interface components from top to bottom
# valid values: drawarea menu main_toolbar pen_toolbar statusbar
interface_order=menu main_toolbar pen_toolbar drawarea statusbar
# interface components in fullscreen mode, from top to bottom
interface_fullscreen=main_toolbar pen_toolbar drawarea
# interface has left-handed scrollbar (true/false)
interface_lefthanded=false
# hide some unwanted menu or toolbar items (true/false)
shorten_menus=false
# interface items to hide (customize at your own risk!)
# see source file xo-interface.c for a list of item names
shorten_menu_items=optionsProgressiveBG optionsLeftHanded optionsButtonSwitchMapping
# highlighter opacity (0 to 1, default 0.5)
# warning: opacity level is not saved in xoj files!
highlighter_opacity=0.50
# auto-save preferences on exit (true/false)
autosave_prefs=true
# force PDF rendering through cairo (slower but nicer) (true/false)
poppler_force_cairo=false
# prefer xournal's own PDF code for exporting PDFs (true/false)
exportpdf_prefer_legacy=false
# fix origin of strokes (devices with unreliable button press coordinates, e.g. Lenovo's AES pens) (true/false)
fix_stroke_origin=false
# when attempting to open a non-existent file, treat it as a new file (true/false)
autocreate_new_xoj=false
# export successive layers on separate pages in PDFs (true/false)
exportpdf_layers=false
[paper]
# the default page width, in points (1/72 in)
width=612.00
# the default page height, in points (1/72 in)
height=792.00
# the default paper color
color=white
# the default paper style (plain, lined, ruled, or graph)
style=lined
# apply paper style changes to all pages (true/false)
apply_all=false
# preferred unit (cm, in, px, pt)
default_unit=cm
# include paper ruling when printing or exporting to PDF (true/false)
print_ruling=true
# when creating a new page, duplicate a PDF or image background instead of using default paper (true/false)
new_page_duplicates_bg=false
# just-in-time update of page backgrounds (true/false)
progressive_bg=true
# bitmap resolution of PS/PDF backgrounds rendered using ghostscript (dpi)
gs_bitmap_dpi=144
# bitmap resolution of PDF backgrounds when printing with libgnomeprint (dpi)
pdftoppm_printing_dpi=150
[tools]
# selected tool at startup (pen, eraser, highlighter, selectregion, selectrect, vertspace, hand, image)
startup_tool=pen
# Use the pencil from cursor theme instead of a color dot (true/false)
pen_cursor=false
# default pen color
pen_color=black
# default pen thickness (fine = 1, medium = 2, thick = 3)
pen_thickness=2
# default pen is in ruler mode (true/false)
pen_ruler=false
# default pen is in shape recognizer mode (true/false)
pen_recognizer=false
# default eraser thickness (fine = 1, medium = 2, thick = 3)
eraser_thickness=2
# default eraser mode (standard = 0, whiteout = 1, strokes = 2)
eraser_mode=2
# default highlighter color
highlighter_color=yellow
# default highlighter thickness (fine = 1, medium = 2, thick = 3)
highlighter_thickness=2
# default highlighter is in ruler mode (true/false)
highlighter_ruler=false
# default highlighter is in shape recognizer mode (true/false)
highlighter_recognizer=false
# button 2 tool (pen, eraser, highlighter, text, selectregion, selectrect, vertspace, hand, image)
btn2_tool=hand
# button 2 brush linked to primary brush (true/false) (overrides all other settings)
btn2_linked=true
# button 2 brush color (for pen or highlighter only)
btn2_color=white
# button 2 brush thickness (pen, eraser, or highlighter only)
btn2_thickness=0
# button 2 ruler mode (true/false) (for pen or highlighter only)
btn2_ruler=false
# button 2 shape recognizer mode (true/false) (pen or highlighter only)
btn2_recognizer=false
# button 2 eraser mode (eraser only)
btn2_erasermode=2
# button 3 tool (pen, eraser, highlighter, text, selectregion, selectrect, vertspace, hand, image)
btn3_tool=eraser
# button 3 brush linked to primary brush (true/false) (overrides all other settings)
btn3_linked=true
# button 3 brush color (for pen or highlighter only)
btn3_color=white
# button 3 brush thickness (pen, eraser, or highlighter only)
btn3_thickness=2
# button 3 ruler mode (true/false) (for pen or highlighter only)
btn3_ruler=false
# button 3 shape recognizer mode (true/false) (pen or highlighter only)
btn3_recognizer=false
# button 3 eraser mode (eraser only)
btn3_erasermode=2
# thickness of the various pens (in points, 1 pt = 1/72 in)
pen_thicknesses=0.42;0.85;1.41;2.26;5.67
# thickness of the various erasers (in points, 1 pt = 1/72 in)
eraser_thicknesses=2.83;8.50;19.84
# thickness of the various highlighters (in points, 1 pt = 1/72 in)
highlighter_thicknesses=2.83;8.50;19.84
# name of the default font
default_font=Sans
# default font size
default_font_size=12.0
@sambacha
Copy link

sambacha commented Aug 3, 2022

Thank you for sharing this and writing these article’s, have found them very helpful!

Copy link

ghost commented Sep 16, 2023

Rest in Peace.

Gilles Castel, † Deceased on July 18 2022. Link.

@physicophilic
Copy link

Gilles Castel had been an inspiration. I feel so sad because of this. He was so special for so many of us.
I will forever be indebted for all these things he created and shared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment