TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a macro that contains the title for the current section, however when using the titlesec package, it no longer works for \section and \subsection. I know titlesec redefines the functions I'm using, but have not been able to figure out a workaround.







\part*{First Starred part}

\part{First Un-starred part}

\section*{First Starred Section}

\section{Second Un-starred Section}

\subsection*{First Starred Subsection}

\subsection{Second Un-starred Subsection}

share|improve this question
Welcome to TeX.sx! A tip: You can use backticks ` to mark your inline code as I did in my edit. – Torbjørn T. Nov 21 '11 at 21:54
up vote 2 down vote accepted

For \section and lower level titles you can do


However, if you're not going to hide titles in groups, the simple


should suffice.

For \part your code still works and I believe also the similar one for \chapter.

share|improve this answer
The first approach was exactly what I was looking for. Thanks! – lyineyes Nov 21 '11 at 22:37
Could you please explain how to use these commands? An example would really help. – wkschwartz Nov 9 '15 at 17:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.