我正在 macOS Sierra 上使用 TeXShop 版本 3.88 在 Latex 上撰写我的硕士论文。有人能帮我解释一下为什么我的段落都没有缩进吗?
梅威瑟:
\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usepackage{cite}
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath, nccmath, amsfonts, amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{trfsigns}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{datetime}
\usepackage{multirow}
\usepackage{placeins}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{relsize}
\usepackage{comment}
\usepackage{Macros_SCF}
\usepackage{mathrsfs}
\usepackage[toc]{glossaries}
\usepackage{indentfirst}
\includecomment{Graphics}
\titleformat{\section}{\normalfont\large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\paragraph}{\normalfont\bfseries}{\theparagraph}{}{}
\titlespacing{\section}{0pt}{6pt}{6pt}
\titlespacing{\subsection}{0pt}{3pt}{3pt}
\titlespacing{\paragraph}{0pt}{3pt}{-1pt}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\addtolength{\textwidth}{2.1cm}
\addtolength{\topmargin}{-2.4cm}
\addtolength{\oddsidemargin}{-1.1 cm}
\addtolength{\textheight}{4.5cm}
\setlength{\columnsep}{0.7cm}
\newlength{\mytocsep}
\setlength{\mytocsep}{1.5em}
\titlecontents{section}[0pt]{\addvspace{1pc}\bfseries}{\contentslabel{\mytocsep}}{}
{\titlerule*[0.5pc]{-}\contentspage}
\newcommand{\myunnumberedsection}[1]{\addcontentsline{toc}{section}{#1}%
\section*{#1}}
\begin{document}
\setlength\parindent{30pt}
\section{Introduction}
\begin{flushleft}
\subsection{first subsection}
\end{flushleft}
\begin{flushleft}
This is the first paragraph. This is the first paragraph. This is the first paragraph.
\indent
This is the second paragraph, which should be indented but is not.
This is the second paragraph, which should be indented but is not.
This is the second paragraph, which should be indented but is not.
\end{flushleft}
\end{document}
答案1
默认情况下,LaTeX 不会在章节标题后缩进,但您已使用命令覆盖该功能\titlespacing
,\titlespacing*
表单将保留不缩进的默认行为,因此
\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usepackage{cite}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath, nccmath, amsfonts, amssymb, amsthm}
\usepackage{color}
\usepackage{array}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{trfsigns}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{datetime}
\usepackage{multirow}
\usepackage{placeins}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{relsize}
\usepackage{comment}
% not availaible\usepackage{Macros_SCF}
\usepackage{mathrsfs}
\usepackage[toc]{glossaries}
\includecomment{Graphics}
\titleformat{\section}{\normalfont\large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\paragraph}{\normalfont\bfseries}{\theparagraph}{}{}
\titlespacing*{\section}{0pt}{6pt}{6pt}
\titlespacing*{\subsection}{0pt}{3pt}{3pt}
\titlespacing*{\paragraph}{0pt}{3pt}{-1pt}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\addtolength{\textwidth}{2.1cm}
\addtolength{\topmargin}{-2.4cm}
\addtolength{\oddsidemargin}{-1.1 cm}
\addtolength{\textheight}{4.5cm}
\setlength{\columnsep}{0.7cm}
\newlength{\mytocsep}
\setlength{\mytocsep}{1.5em}
\titlecontents{section}[0pt]{\addvspace{1pc}\bfseries}{\contentslabel{\mytocsep}}{}
{\titlerule*[0.5pc]{-}\contentspage}
\newcommand{\myunnumberedsection}[1]{\addcontentsline{toc}{section}{#1}%
\section*{#1}}
\setlength\parindent{30pt}
\begin{document}
\section{Introduction}
\subsection{first subsection}
This is the first paragraph. This is the first paragraph. This is the first paragraph.
This is the second paragraph, which should be indented but is not.
This is the second paragraph, which should be indented but is not.
\end{document}