我正在撰写论文report class
。我试图在每个部分后缩进第一段。
包括\usepackage{indentfirst}
在序言中似乎只缩进章节标题后的第一段。它不会缩进紧接在章节之后的第一段。任何缩进章节后第一段的建议都会有所帮助。
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[titletoc]{appendix}
\usepackage{lipsum}
\usepackage{indentfirst}
\usepackage{graphicx}
\graphicspath{{Images/}}
\usepackage[a4paper,margin=1in]{geometry}
%%%For absolute positioning on the title page
\usepackage[absolute]{textpos}
\setlength{\TPHorizModule}{\paperwidth}
\setlength{\TPVertModule}{10in}
%%%%
\usepackage{fancyhdr}
%%%%Adding figure captions in italics and color
\usepackage[svgnames]{xcolor}
\definecolor{blue}{RGB}{101,140,191}
\usepackage{caption}
\usepackage[font={color=blue}]{caption}
%%%%%
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{hyperref}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[indentafter]{titlesec} %%%%to set the size of different headers
%%%%%Setting the spacing before and after the section titles
%%%%%
\titlespacing{\chapter}{0pt}{20pt plus 0pt minus 0pt}{20pt plus 0pt minus 0pt}
\titlespacing{\section}{0pt}{20pt plus 0pt minus 0pt}{20pt plus 0pt minus 0pt}
\titlespacing{\subsection}{0pt}{20pt plus 0pt minus 0pt}{20pt plus 0pt minus 0pt}
\titlespacing{\subsubsection}{0pt}{20pt plus 0pt minus 0pt}{20pt plus 0pt minus 0pt}
%%%%%
\usepackage{indentfirst}
\usepackage{float} %%%% To restrict the location of figure
\usepackage{array} %%%% This is used for controlling the width of table. If left controlled, the text may span more space than permitted by the
% command \textwidth
\usepackage{chemmacros} %%%% for representing the ions in non-italicized font
\usepackage{textgreek} %%%For printing non-italicized greek letters
\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}} %%%% This package is for writing chemical equations
\renewcommand{\chaptername}{CHAPTER}
\renewcommand{\appendixname}{APPENDIX}
%%%%%
\usepackage{titletoc}
\setcounter{tocdepth}{0}
\newcommand{\setupname}[1][\chaptername]{
\titlecontents{chapter}[0pt]{\vspace{1ex}}{#1~\thecontentslabel:\quad}{}{\mdseries\titlerule*[0.75em]{.}\contentspage}[]
}
%%%%
%%%%%
%\setlength{\intextsep}{5pt plus 1.0pt minus 2.0pt} %%%%For controlling the spacing between figure and text
%\setlength{\floatsep}{5pt plus 1.0pt minus 2.0pt} %%%%For controlling the spacing between figure and text
%\setlength{\textfloatsep}{5pt plus 1.0pt minus 2.0pt} %%%%For controlling the spacing between figure and text
\usepackage{siunitx}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}} %%% New column time defined for centering columns
\titleformat*{\section}{\large}
\titleformat*{\subsection}{\large}
\titleformat*{\subsubsection}{\large}
\titleformat*{\paragraph}{\large}
\titleformat*{\subparagraph}{\large}
%%%%
%%%%
%\pagestyle{fancy}
%\fancyhead{}
%\fancyhead[RO,LE]{Thesis Title}
%\fancyfoot{}
%\fancyfoot[LE,RO]{\thepage}
%\fancyfoot[LO,CE]{Chapter\thechapter}
%\fancyfoot[CO,RE]{Vikram Kumar}
%\renewcommand{\headrulewidth}{0.4pt}
%\renewcommand{\footrulewidth}{0.4pt}
\usepackage[style=chem-acs,sorting=none]{biblatex}\addbibresource{references.bib} %%%sorting is set equal to none for having the references appear in the order they are cited
\addbibresource{introduction.bib}
\addbibresource{characterization.bib}
\addbibresource{data.bib}
\usepackage{ragged2e} %%%For aligning the text
%%%%Adjustment of Title
\titleformat{\chapter}[hang]
{\mdseries\large}{\chaptertitlename\ \thechapter:}{1em}{\centering}
\begin{document}
\pagenumbering{roman}
\chapter*{}
\vspace*{\fill}
\textit{To my Parents}
\vspace*{\fill}
\begin{spacing}{1.75}
\justify
\chapter*{ACKNOWLEDGMENTS}
%\par
\lipsum.%\par
\renewcommand*\contentsname{TABLE OF CONTENTS}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}
\setupname
\chapter{INTRODUCTION}\label{chap:intro}
\lipsum %\par
\lipsum %\par
\begin{flushleft}
\section{Problem Statement and Organization}\label{sec:problemstatment}
\end{flushleft}
%par
\lipsum
\begin{flushleft}
\section{Detailed Investigations}\label{sec:problemstatment}
\end{flushleft}
%par
\lipsum
%%%%
\end{spacing}
\begin{spacing}{1.5}
\overfullrule=0pt
\addcontentsline{toc}{chapter}{REFERENCES}
\printbibliography[title={REFERENCES}]
\end{spacing}
\end{document}
答案1
\begin{flushleft}
\section{Problem Statement and Organization}\label{sec:problemstatment} \end{flushleft}
破坏了几乎所有 latex 的节标题控制。只需删除 flushleft 环境即可。
除了将标题放在组内的特殊问题(这可以防止它影响组外的后续段落)之外,章节标题不应该在文档中以内联形式出现,而应该作为文档设计的一部分在文档类中指定,或者,如果不行,则在序言中指定。
如果想要让右侧章节标题不整齐,可以更改
\titleformat*{\section}{\large}
到
\titleformat*{\section}{\raggedright\large}