Skip to content

Instantly share code, notes, and snippets.

@dvdmrn
Last active September 27, 2023 23:07
Show Gist options
  • Save dvdmrn/538eb471261834cf672d742a6eae5091 to your computer and use it in GitHub Desktop.
Save dvdmrn/538eb471261834cf672d742a6eae5091 to your computer and use it in GitHub Desktop.
A simple way to define inline comments for LaTeX. Extend with your own colours (e.g. xcolor package) and use cases (e.g. todos)
\usepackage{tcolorbox}
\newcommand{\setCommenter}[3]{
\expandafter\newcommand\csname #1\endcsname[1]{\textcolor{#3}{\tcbox[on line, boxsep=0pt, left=2pt, right=2pt, top=2pt, bottom=2pt, colback=#3!80!white, arc=4pt, colframe=white, fontupper=\color{white}]{#2} [##1]}}
}
% define your comments here
\setCommenter{alice}{Alice A.}{blue}
\setCommenter{bob}{Bob B.}{red}
% make inline comments by going \alice{my cool comment}
% import into your main.tex file with \input{comments.tex}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment