自定义 subsubsubsection 命令与表格环境冲突

自定义 subsubsubsection 命令与表格环境冲突

我使用这个命令来处理 4 层和 5 层的子部分:

%-----------------------------------------------------------------------------
% add subsubsubsection
\newcommand{\subsubsubsection}[1]{\paragraph{#1}\mbox{}\\}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
% add subsubsubsubsection
\newcommand{\subsubsubsubsection}[1]{\paragraph{#1}\mbox{}\\}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
%-----------------------------------------------------------------------------

我的问题是 pdf 的顺序不对。尽管在代码中表格位于子子子节实例之前,但 pdf 中的表格位于这些子子子节实例之后。

我认为该命令缺少控制位置并使其像正常小节一样运行的必要部分。

请帮助我完成缺失的部分以使该命令更好地发挥作用。

编辑:我正在使用的表格的一个示例:

\begin{table}[h]
\begin{tabular}{lll}
 &  &  \\
 &  &  \\
 &  & 
\end{tabular}
\end{table}

第二次编辑:如何为要实现的命令添加位置参数,例如:

\subsubsubsection{some title}[h]

编辑 3:请求最小示例

\documentclass[
    paper=a4,                       % Papierformat
    oneside,                        % einseitig
    fontsize=13pt,                % Schriftgröße
    headsepline=.5pt,             % untere Kopfzeilenlinie
    numbers=noenddot,             % 1.1.1. --> 1.1.1
    parskip=half,                 % halber Absatz
    captions=tableheading,        % Tabellenüberschriften
    DIV=12,                       % Satzspiegel (KOMA-Script)
%   toc=bibliography,             % Quellenverzeichnis ins Inhaltsverzeichnis aufnehmen
    %tocdepth=3,                  % Begrenzung der Ebenen im Inhaltsverzecihnis
    %headings=normal,                           % Größe der überschriften verkleinern
    final                                                   % Status des Dokuments (final/draft)
]{scrartcl}
%-----------------------------------------------------------------------------------------------------------
\begin{document}
%-----------------------------------------------------------------------------
%add subsubsubsection
\newcommand{\subsubsubsection}[1]{\paragraph{#1}\mbox{}\\}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
%add subsubsubsubsection
\newcommand{\subsubsubsubsection}[1]{\paragraph{#1}\mbox{}\\}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
%-----------------------------------------------------------------------------
\section{1st tier}
\begin{table}[h]
\begin{tabular}{lll}
a & a & a \\
a & a & a \\
a & a & a \\
\end{tabular}
\end{table}
\subsection{2nd tier}
\begin{table}[h]
\begin{tabular}{lll}
a & a & a \\
a & a & a \\
 a & a & a \\
\end{tabular}
\end{table}
\subsubsection{3rd tier}
\begin{table}[h]
\begin{tabular}{lll}
a & a & a \\
a & a & a \\
a & a & a \\
\end{tabular}
\end{table}
\subsubsubsection{4th tier}
\begin{table}[h]
\begin{tabular}{lll}
a & a & a \\
a & a & a \\
a & a & a \\
\end{tabular}
\end{table}
\subsubsubsubsection{5th tier}
\begin{table}[h]
\begin{tabular}{lll}
a & a & a \\
a & a & a \\
a & a & a \\
\end{tabular}
\end{table}

\end{document}

相关内容