我的目標如問題標題所示。還有其他問題可以解決這個問題,但據我所知,所選的答案與我的其他現有程式碼不一致,總結如下。
\documentclass[11pt]{article}
\usepackage{amsmath,amsthm,titlesec}
\numberwithin{equation}{section}
\newcommand{\periodafter}[1]{#1.}
\newcommand{\presectionskip}{-1\baselineskip}
\newcommand{\postsectionskip}{0.3\baselineskip}
\makeatletter
\renewcommand{\section}{\@startsection
{section}{1}{0mm}%% name, level, indent
{\presectionskip}% % beforeskip
{\postsectionskip}% % afterskip
{\normalfont\LARGE\bfseries}}% % style
\renewcommand{\subsection}{\@startsection
{subsection}{2}{0mm}
{\presectionskip}
{\postsectionskip}
{\normalfont\Large\bfseries}}
\renewcommand{\subsubsection}{\@startsection
{subsubsection}{3}{0mm}
{\presectionskip}
{\postsectionskip}
{\normalfont\normalsize\bfseries}}
\makeatother
%\usepackage[font=bf]{caption}
%\titleformat{\section}{}{\thesection.}{1ex}{\periodafter}
%\titleformat{\subsection}{}{\thesubsection.}{1ex}{\periodafter}
%\titlelabel{\thetitle.\quad}
\begin{document}
\section{Good section}\label{sec:refl}
\subsection{Superior subsection}\label{tableworks}
\subsubsection{This, the best of all subsections}
\end{document}
感謝您提供有關如何使其發揮作用的任何想法。
答案1
提供的解決方案這裡工作完美。您是否也擔心參考文獻中出現點?
% arara: pdflatex
\documentclass[11pt]{article}
\usepackage{titlesec}
\newcommand{\presectionskip}{-1\baselineskip}
\newcommand{\postsectionskip}{0.3\baselineskip}
\makeatletter
\renewcommand{\section}{\@startsection
{section}{1}{0mm}%% name, level, indent
{\presectionskip}% % beforeskip
{\postsectionskip}% % afterskip
{\normalfont\LARGE\bfseries}}% % style
\renewcommand{\subsection}{\@startsection
{subsection}{2}{0mm}
{\presectionskip}
{\postsectionskip}
{\normalfont\Large\bfseries}}
\renewcommand{\subsubsection}{\@startsection
{subsubsection}{3}{0mm}
{\presectionskip}
{\postsectionskip}
{\normalfont\normalsize\bfseries}}
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname.\quad}
\makeatother
\usepackage{blindtext}
\begin{document}
\section{Good section}\label{sec:refl}
\subsection{Superior subsection}\label{tableworks}
\subsubsection{This, the best of all subsections}
\blindtext
\end{document}