In my question here how to properly add to a macro without storing the original one in a tmp variable, I was told that my code is actually working. However, it somehow clashes with the titlesec package.
How can I change my code to properly work along the titlesec package while still not defining a tmp variable for the original macro?
\documentclass{article}
\usepackage{titlesec}
\def\abc{abc}
\begingroup\let\orgabc\abc\def\abc{\orgabc\endgroup def}
\begin{document}
\section{One}
\abc
\section{Two}
Two
\end{document}
Works fine with \usepackage{titlesec} commented out!
\abcthat you want, with or without the titlesec package it wil completely break latex as it puts\begin{document}inside a group, also if you use\abcmore than once you will get an error over an unmatched\endgroup. Surely you do not want the\endgroupto be in the definition of\abc? – David Carlisle Feb 28 '17 at 08:52tex-coreor alatex-basequestion? – jarnosc Feb 28 '17 at 22:05\defand\endgroup– David Carlisle Feb 28 '17 at 22:09