如何将零件名称和标题设置在同一行?

如何将零件名称和标题设置在同一行?

如何在同一行上设置零件名称和标题。现在(默认情况下),零件编号在一行,零件名称在下面一行...例如,而不是

第一部分
这是我的标题

我想

第一部分 这是我的标题

这是一个简单的代码:

% Preview source code

%% LyX 2.0.5.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\begin{document}

\part{why this line is one line down?}

How can I make the the name of part one will be at the same line at
the PDF output.
\end{document}

编辑:这是我的文档序言:

% Preview source code

%% LyX 2.0.5.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,hebrew]{article}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[T1]{fontenc}
\usepackage[cp1255]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm}
\setlength{\parindent}{0bp}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[all]{xy}
\PassOptionsToPackage{normalem}{ulem}
\usepackage{ulem}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\usepackage{theorem}
\theorembodyfont{\upshape}
\newtheorem{theorem}{\R{משפט}}[section]
\AtBeginDocument{\make@lr\thetheorem}
\newenvironment{proof}%
{\R{\textbf{הוכחה:}}}%
{\hfill\rule{2mm}{2mm}\par\vspace{2mm}}
\newtheorem{claim}[theorem]{\R{טענה}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{cancel}
\usepackage{pifont}
\usepackage{keystroke}
\usepackage{bbding}
\makeatletter
\newcommand{\xyR}[1]{%
\makeatletter
\xydef@\xymatrixrowsep@{#1}
\makeatother
} % end of \xyR
\makeatletter
\newcommand{\xyC}[1]{%
\makeatletter
\xydef@\xymatrixcolsep@{#1}
\makeatother
} % end of \xyC
\def\thepart{\alph{part}}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@part}{\par}{\quad}{}{}
\patchcmd{\@part}{\Large}{\huge}{}{}
\makeatother

\makeatother

\usepackage{babel}
\begin{document}

当我将上面的代码添加到此处时,它不起作用......


以下是我的文件序言:

% Preview source code

%% LyX 2.0.5.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,hebrew]{article}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[T1]{fontenc}
\usepackage[cp1255]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm}
\setlength{\parindent}{0bp}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[all]{xy}
\PassOptionsToPackage{normalem}{ulem}
\usepackage{ulem}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\usepackage{theorem}
\theorembodyfont{\upshape}
\newtheorem{theorem}{\R{משפט}}[section]
\AtBeginDocument{\make@lr\thetheorem}
\newenvironment{proof}%
{\R{\textbf{הוכחה:}}}%
{\hfill\rule{2mm}{2mm}\par\vspace{2mm}}
\newtheorem{claim}[theorem]{\R{טענה}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{cancel}
\usepackage{pifont}
\usepackage{keystroke}
\usepackage{bbding}
\makeatletter
\newcommand{\xyR}[1]{%
\makeatletter
\xydef@\xymatrixrowsep@{#1}
\makeatother
} % end of \xyR
\makeatletter
\newcommand{\xyC}[1]{%
\makeatletter
\xydef@\xymatrixcolsep@{#1}
\makeatother
} % end of \xyC
\def\thepart{\alph{part}}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@part}{\par}{\quad}{}{}
\patchcmd{\@part}{\Large}{\huge}{}{}
\makeatother

\makeatother

\usepackage{babel}
\begin{document}

当我将上面的代码添加到此处时,它不起作用......

答案1

驱动显示的定义\part实际上是\@part

\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
    {\parindent \z@ \raggedright
     \interlinepenalty \@M
     \normalfont
     \ifnum \c@secnumdepth >\m@ne
       \Large\bfseries \partname\nobreakspace\thepart
       \par\nobreak
     \fi
     \huge \bfseries #2%
     \markboth{}{}\par}%
    \nobreak
    \vskip 3ex
    \@afterheading}

部件名称和编号设置在 中\Large\bfseries,后跟\par。您可以\par使用来自 的补丁删除此图形中断etoolbox通过将以下内容添加到文档前言中(文档 > 设置... > LaTeX 前言):

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@part}{\par}{\quad}{}{}
\makeatother

上述补丁\par\quad1em空格)替换:

在此处输入图片描述

看起来不太好看...也许您可以通过另一个序言添加来更新零件名称/编号以计算零件标题的字体:

\renewcommand{\partname}{\huge Part}

在此处输入图片描述

将以下补丁与上一个补丁添加即可获得类似的输出:

\patchcmd{\@part}{\Large}{\huge}{}{}

相关内容