我正在使用报告类,并使用以下命令将部分深度设置为 5:
\setcounter{secnumdepth}{5}
但是,当我使用 \paragraph{} 部分时,编译后的 pdf 会在下一部分之前添加分页符。
我怎样才能摆脱这个分页符?
例子:
\paragraph{example section}~\\ \indent
example phrase
编辑 02/29/16 有人提出,发布的代码不会产生相同的结果。以下是代码:
\documentclass{report}
% Set paper size
\usepackage[letterpaper]{geometry}
% This sets up the header.
\usepackage{fancyhdr}
% Indent first paragraph of each section
\usepackage{indentfirst}
% Adding pictures
\usepackage{graphicx}
% Provides unnumbered equations
\usepackage{amsmath}
% Number citations based on position in text and not TOC, LOF, LOT, LOE
\usepackage{notoccite}
% Common text symbols
\usepackage{textcomp}
% url and section linking support
\usepackage[colorlinks=true,linkcolor=black,anchorcolor=black,citecolor=black,filecolor=black,menucolor=black,runcolor=black,urlcolor=black] {hyperref}
% Section levels
\setcounter{secnumdepth}{5} % depth of sections/paragraphs
% \setcounter{tocdepth}{5} % depth of table of contents
% Acronym package
\usepackage{acro}
\acsetup{first-style=short}
% include pdfs
\usepackage{pdfpages}
% Properly format code
\usepackage{listings}
\usepackage{color}
\usepackage{courier}
\pagestyle{fancy}
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{-3.25ex \@plus1ex \@minus.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\makeatother
\begin{document}
...
\subsubsection{CRS Safety}
\subsection{Previous Team's Project}
\section{Biometrics}
\subsection{Detecting the User State}
\subsubsection{Electrical Activity in Skeletal Muscles}
\paragraph{Muscle Control of Lower Limb Movement in Transfemoral Amputee}
that when i type for a paragraph
...
\end{document}
我并不介意文本从同一行开始,只是介意段落后有一个分页符。
答案1
发布的代码不会生成显示的图像(example phrase
出现在下一行),也不允许分页,下面的代码显示
如果将页面高度减少一行,通过更改
\addtolength\textheight{-9\baselineskip}
到
\addtolength\textheight{-10\baselineskip}
整个部分\paragraph
(包括其标题)将移动到下一页。
\documentclass{report}
\setcounter{secnumdepth}{5}
\addtolength\textheight{-9\baselineskip}
\begin{document}
\chapter{zzz}
Z
ZZ
ZZ
\section{aaa}
A
AA
\subsection{bbb}
B
BB
\subsubsection{qqqqqqq}
Q
QQ
\paragraph{example section}~\\ \indent
example phrase
EEE1
EEE2
\end{document}
但是你永远不应该使用这样的结构,你应该像使用一样~\\ \indent
使用。如果你需要将其变成显示标题,请使用以下方式调整其定义\paragraph
\section
\@startsection
\documentclass{report}
\setcounter{secnumdepth}{5}
\addtolength\textheight{-9\baselineskip}
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{-3.25ex \@plus1ex \@minus.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\makeatother
\begin{document}
\chapter{zzz}
Z
ZZ
ZZ
\section{aaa}
A
AA
\subsection{bbb}
B
BB
\subsubsection{qqqqqqq}
Q
QQ
\paragraph{example section}
example phrase
EEE1
EEE2
\end{document}