应该1
在右边,有一个小字Chapter
。但是我的代码
\documentclass[a4paper,11pt,twoside]{report}
%\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1.25in,rmargin=1in}
\usepackage[autostyle]{csquotes}
\usepackage[dvipsnames]{xcolor}
\usepackage[labelfont=bf]{caption}
\usepackage{emptypage}
%\usepackage{mathrsfs}
\usepackage{titlesec}
\usepackage{amsmath,amsfonts,mathtools}
\numberwithin{equation}{section}
\linespread{1.3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\chapnumfont}{% % define font for chapter number
\usefont{T1}{pnc}{b}{n}% % choose New Chancery, bold, normal shape
\fontsize{50}{50}% % font size 100pt, baselineskip 100pt
\selectfont% % activate font
}
\colorlet{chapnumcol}{gray!75} % color for chapter number
\titleformat{\chapter}[display]
{\filright\bfseries}
{\filleft\chapnumfont\textcolor{chapnumcol}{\thechapter}}
{-4pt}
{\Huge}
\titlespacing*{\chapter}{0pt}{-20pt}{10pt}
%\renewcommand{\chapterheadstartvskip}{\vspace*{-4\baselineskip}}
%\setlength{\beforechapskip}{20pt}
\begin{document}
\input{abstract.tex}
\addcontentsline{toc}{chapter}{Abstract}
\clearpage
%%%%%%%%%%%%%%%%%%% Table of contents %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tableofcontents
\pagenumbering{arabic}
\include{ch1}
\vspace{-0.5\baselineskip}
\end{document}
虽然我已经明确给出了{\filright\bfseries}
,但是 1 被放在了中心。如何正确定位?
答案1
您不需要同时使用 filright 和 fillleft。
\documentclass[a4paper,11pt,twoside]{report}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1.25in,rmargin=1in}
\usepackage[dvipsnames]{xcolor}
\usepackage{titlesec}
\linespread{1.3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\chapnumfont}{% % define font for chapter number
\usefont{T1}{pnc}{b}{n}% % choose New Chancery, bold, normal shape
\fontsize{50}{50}% % font size 100pt, baselineskip 100pt
\selectfont% % activate font
}
\colorlet{chapnumcol}{gray!75} % color for chapter number
\titleformat{\chapter}[display]
{\bfseries}
{\filleft{\Huge Chapter }\chapnumfont\textcolor{chapnumcol}{\thechapter}}
{-4pt}
{\titlerule[1.5pt]\Huge}[{\titlerule[1.5pt]}]
\titlespacing*{\chapter}{0pt}{-20pt}{10pt}
%\renewcommand{\chapterheadstartvskip}{\vspace*{-4\baselineskip}}
%\setlength{\beforechapskip}{20pt}
\begin{document}
\chapter{Title chapter}
\end{document}
结果: