I am using Overleaf with compiler pdfLaTeX (not sure if this is important), and want to have subsections of different colors, such as the example shown below after the end of the question.
It all works and is fine for compiling. However, as my subsections could get quite large, I would like to be able to fold the \topic{}{}
functions just like you are able to do with the \section{}
and \subsection{}
functions (see final image below).
Is there any way to tell the editor that I would like this function to do this?
Note that I don't particularly care whether defining the new function \topic{}{} is the best way to achieve what I want (that can be a separate question if needed). Rather I am interested here in whether it is possible in general to code-fold with some arbitrarily defined function - my \topic{}{} function is just a short little example.
\documentclass{article}
\usepackage{blindtext}
\setlength{\parindent}{0em}
\setlength{\parskip}{0em}
\usepackage{xcolor}
\newcommand{\topic}[2]{\color{#1}\subsection*{#2}}
\begin{document}
\section{Hello}
\topic{blue}{This subsection is in blue}
\blindtext
\topic{orange}{This subsection is in orange}
\blindtext
\topic{purple}{This subsection is in purple}
\blindtext
\end{document}