I put the title of my examples in a single table cell to create a look of half a box around it with the following code
\newtheorem*{example}{\begin{tabular}{r|}example\\\hline\end{tabular}}
How can I do something similar for section titles? I tried:
\makeatletter
\renewcommand\section{\begin{tabular}{r|}\\\hline\end{tabular}}
\makeatother
but this doesn't work.
A minimal working example:
\documentclass[a4paper,11pt]{book}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{array}
\newcolumntype{L}{>{\raggedright\arraybackslash}p{0.5\linewidth}}
\renewcommand{\arraystretch}{1.5}
\renewcommand{\headrulewidth}{0pt}
\setlength\arrayrulewidth{1pt}
\theoremstyle{definition}
\newtheorem*{example}{\begin{tabular}{r|}example\\hline\end{tabular}}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother
\begin{document}
\section*{first}
\begin{example}
content
\end{example}
\end{document}

\section? – Mico Jun 08 '23 at 13:25\renewcommands. Just, say,\section{\begin{tabular}{|c|} aa \\ bb \end{tabular}}. I must confess that I, like the other commenters, am absolutely clueless as to what you're trying to achieve. Incidentally, the fact that you prefer to refuse to say what it is that you may be trying to achieve doesn't really help your cause. – Mico Jun 08 '23 at 13:43\sectiondirectives before\begin{document}?? This makes no sense at all. No wonder we're having major difficulties understanding what you're trying to do... – Mico Jun 08 '23 at 13:46