[Tex/LaTex] Writing in the same line as the section title

bookmarksline-breakingsectioningtable of contents

I needed to add some text after some of my section title and it certainly needs to be in the same line, and not to be in ToC or bookmarks.

Therefore i decided to create my own subsection-type-thingy with an option to write text after the title, and that text wouldn't be added to ToC and bookmarks.

Is there any clean way to do that? (by redefining subsection which i cannot find a nice tuorial on, or some other way?)

my thingy:
(i removed all font things and so on as they aren't the clue)

\def\MySubSection#1#2{\pagebreak[3]\noindent\thesection{.}\arabic{@MyCounter} #1 #2\addcontentsline{toc}{subsection}{\protect\numberline{\thesection.\arabic{@MyCounter}}#1}\\}

Best Answer

The sectioning macros have an optional argument to specify a short version for the ToC which is also used for the PDF bookmarks. You can then add your text in the normal argument after the title. To change the size and font to normal use \normalsize and \normalfont:

\section[Short Title for ToC]{Long title {\normalsize\normalfont some more text}}

Result:

Result

Same counts for \subsection, \subsubsection, ... (and also \caption).

Related Question