Skip to content

Instantly share code, notes, and snippets.

@andreas-bauer
Created August 12, 2025 09:43
Show Gist options
  • Select an option

  • Save andreas-bauer/c8ca14fc031883173ea2ec2867e35c37 to your computer and use it in GitHub Desktop.

Select an option

Save andreas-bauer/c8ca14fc031883173ea2ec2867e35c37 to your computer and use it in GitHub Desktop.
LaTeX Revision Mode
% Just to add colors and changebars on modified parts after the definition of a condition. Can be removed in the final version
\usepackage{etoolbox}
\newtoggle{showrevisions}
\toggletrue{showrevisions}
%\togglefalse{showrevisions}
\iftoggle{showrevisions}{%
\usepackage{xcolor}
\usepackage{changebar}
\usepackage[normalem]{ulem}
\newcommand{\removed}[1]{\cbstart\removedfragile{#1}\cbend{}}
\newcommand{\removedfragile}[1]{{\color{red}{\sout{#1}}}{}}
\newcommand{\added}[1]{\cbstart\addedfragile{#1}\cbend{}}
\newcommand{\addedfragile}[1]{{\color{green!50!black}{#1}}{}}
\newcommand{\changed}[2]{\added{#1}\removed{#2}}
}{%
\newcommand{\removed}[1]{} % non-markup version
\newcommand{\removedfragile}[1]{}
\newcommand{\added}[1]{#1}
\newcommand{\addedfragile}[1]{#1}
\newcommand{\changed}[2]{#1}
}
Usage:
\added{Text to be added}
\changed{New text}{Old text}
\removed{Text to be removed}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment