Skip to content

Instantly share code, notes, and snippets.

@nebil
Last active March 20, 2024 09:13
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nebil/4e114e433c193297c0f3802bc9c33ef4 to your computer and use it in GitHub Desktop.
Save nebil/4e114e433c193297c0f3802bc9c33ef4 to your computer and use it in GitHub Desktop.
💬 remark -- a simple command to add inline notes in LaTeX
% This source code is licensed under a Creative Commons CC0 license.
% More info at <https://creativecommons.org/publicdomain/zero/1.0/>.
\documentclass[12pt]{article}
\usepackage{xcolor}
\begin{document}
% The main goal is to provide an easy way to write annotations in LaTeX.
% This simple snippet of code should serve as a minimal working example.
% Step one
% ==== ===
% We write a command to describe the style of both the box and the text.
% If you think you can do a better job, feel free to adjust these rules.
\newcommand{\remark}[3]{%
{\colorbox{#2}{\sffamily\scriptsize\bfseries\textcolor{white}{#1}}}
{\sffamily\small\itshape\textcolor{#2}{#3}}
}
% Step two
% ==== ===
% We define a new command--using the previously defined one--for each author.
% You can add as many authors as you want; or as many colors as you can name.
\newcommand{\alice}[1]{\remark{Alice}{blue}{#1}}
\newcommand{\bob}[1]{\remark{Bob}{red}{#1}}
% Step three
% ==== =====
% Finally, we add a paragraph with some plain-old vanilla text,
% followed by a couple of inline remarks made by Alice and Bob.
As a minimal working example, we add a paragraph with some plain-old vanilla text.
\alice{This is a quite remarkable paragraph, I must say!}
\bob{Thank you for that insightful inline remark, Alice.}
\end{document}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hukipola
Copy link

Amazing, simple yet beautiful

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