Is it possible to start your text right after the section or subsection title (without starting a new line)? Thank you. I hope the question is clear enough and does not need a MWE.
[Tex/LaTex] Starting text right after section or subsection title
sectioning
Related Solutions
You need to find a frame-related hook. Below I've used \beamer@checkframetitle
that inserts \insertsectiontitle
only for the first frame after \section
:
\documentclass{beamer}
\makeatletter
\newcommand<>{\insertsectiontitle}{\frametitle{\thesection~\insertsection}}
\let\oldbeamer@checkframetitle\beamer@checkframetitle% Store the \frametitle checking mechanism
\renewcommand<>{\section}{%
\gdef\beamer@checkframetitle{% Update \frametitle checking to ...
\insertsectiontitle% ...insert the section title and...
\global\let\beamer@checkframetitle\oldbeamer@checkframetitle% ...revert to it's old definition
}% Regular \section stuff follows
\alt#1{\@ifnextchar[\beamer@section\beamer@@section}
{\beamer@secgobble}}
\makeatother
\begin{document}
\section{title of the last section}
\begin{frame}
content of the frame with the last section in frametitle.
\end{frame}
\begin{frame}
This is the second frame without a title.
\end{frame}
\end{document}
An update to the above, which inserts the \subsection
as \framesubtitle
on the first slide after \section
, and as \frametitle
after that:
\documentclass{beamer}
\makeatletter
\newcommand<>{\insertsectiontitle}{\frametitle{\thesection~\insertsection}}
\newcommand<>{\insertsubsectiontitle}{\frametitle{\thesubsection~\insertsubsection}}
\newcommand<>{\insertsubsectionsubtitle}{\framesubtitle{\thesubsection~\insertsubsection}}
\let\oldbeamer@checkframetitle\beamer@checkframetitle% Store the \frametitle checking mechanism
\renewcommand<>{\section}{%
\gdef\beamer@checkframetitle{% Update \frametitle checking to ...
\insertsectiontitle% ...insert the section title and...
\ifx\relax\insertsubsection\relax
\global\let\beamer@checkframetitle\oldbeamer@checkframetitle% ...revert to it's old definition - no subsection
\else
\insertsubsectionsubtitle% ...insert the subsection title and...
\global\let\beamer@checkframetitle\insertsubsectiontitle% ...always insert subsection
\fi
}% Regular \section stuff follows
\alt#1{\@ifnextchar[\beamer@section\beamer@@section}
{\beamer@secgobble}}
\makeatother
\begin{document}
\section{First section}
\subsection{First subsection}
\begin{frame}
Frame 1
\end{frame}
\begin{frame}
Frame 2
\end{frame}
\subsection{Second subsection}
\begin{frame}
Frame 3
\end{frame}
\begin{frame}
Frame 4
\end{frame}
\section{Second section}
\subsection{First subsection}
\begin{frame}
Frame 5
\end{frame}
\begin{frame}
Frame 6
\end{frame}
\end{document}
Don't put formatting in the \section
argument!
Just define section to be inline rather than display (by changing the sign of the space argument)
\documentclass[english]{amsart}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{amsthm}
\usepackage{setspace}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
\numberwithin{figure}{section}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{mathtools}
\makeatletter
\renewcommand{\section}{%
\@startsection{section}
{1}
\z@
{1\baselineskip plus \baselineskip}
{-1em}
{\normalfont\bfseries}% \scshape
}
\makeatother
\makeatother
\usepackage{babel}
\begin{document}
\section{Introduction.}
\begin{doublespace}
Let $\left\{ x:0\le x<1\right\} $ be the compact group of real numbers
modulo 1.\end{doublespace}
\end{document}
Best Answer
David has already provided the package-free solution; here's another option, using the
titlesec
package (simply selecting therunin
predefined format):