如何让子部分不换行

如何让子部分不换行

我想要一个术语并像下图这样解释。我尝试使用类似

\subsubsection*{Foo}

但没有新线。

在此处输入图片描述

答案1

在声明标题时,LaTeX 使用长度参数的符号作为标志来设置内联或显示样式,因此从article.sty更改中复制的定义进行简单修改就会对运行格式产生影响:

在此处输入图片描述

\documentclass{article}

\begin{document}

\section{bar}zzzz
\subsection{bar bar}zzzz

\subsubsection*{Foo} zzzzzzzzzzzzzz


% from article.cls
%\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
%                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
%                                     {1.5ex \@plus .2ex}%
%                                     {\normalfont\normalsize\bfseries}}
%

% same with 5th argument -ve with a length suitable for horiz space
\makeatletter
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus .2ex}%
                                     {-1em}%
                                     {\normalfont\normalsize\bfseries}}
\makeatother

\subsubsection*{Foo} zzzzzzzzzzzzzz


\end{document}

答案2

下列的大卫的回答,您可以使用包提供的稍微友好的语法titlesec以及以下runin选项:

\documentclass{article}
\usepackage{titlesec}

\begin{document}

\section{bar}zzzz
\subsection{bar bar}zzzz

\subsubsection*{Foo} zzzzzzzzzzzzzz

\titleformat{\subsubsection}[runin]{\normalfont\normalsize\bfseries}{\thesubsubsection}{5pt}{}
\subsubsection*{Foo} zzzzzzzzzzzzzz

\end{document}

答案3

我的印象是你想要一个描述列表:

\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{enumitem}

\begin{document}

\begin{description}[wide,itemindent=\labelsep]
\item[Java API for WordNet searching (JAPS)] Má asi nejjednodušší API,
ale pracuje přímo se soubory Wordnetu na disku a je proto velmi pomalý.

\item[Java WordNet interface (JWI)] Má také velmi jednoduché API a~navíc
umožňuje načíst celý Wordnet do paměti, a proto je velmi rychlý. Pro
účely implementace jednoduchých metod sémantické podobnosti je naprosto
idéalní.~[Fin14]
\end{description}

\end{document}

在此处输入图片描述

答案4

如果您的目标是定义文档中使用的术语,我认为您应该考虑使用该glossaries包。它使对技术术语的全局引用更加容易。

MWE 对此进行了说明:

\documentclass{article}

\usepackage[nopostdot]{glossaries}
\setacronymstyle{long-short-desc}

\makeglossaries

\newglossaryentry{jaws}{name={Java API for WordNet searching},
        short={JAWS},
        description={Mà asi nejjednodussí API\textellipsis{}}
}
\newacronym[description={Má také velmi\textellipsis{}}]{jwi}{JWI}{Java WordNet interface}


\begin{document}

Let’s talk about the \gls{jaws},
also known as
\glsentryshort{jaws}.


\vspace{2\baselineskip}
Then, let’s describe the \gls{jwi}
with some text.

After that, it will be reffered to as \gls{jwi}.

\printglossaries

\end{document}

编译顺序:

lualatex test.tex
makeglossaries test
lualatex test.tex

更多信息glossaries CTAN 文档

相关内容