【问题标题】:LaTeX unwanted itemize indentation on first elementLaTeX 不需要的第一个元素上的逐项缩进
【发布时间】:2019-04-23 12:59:16
【问题描述】:

每当我使用itemize 时,在我的文档中,第一个元素都有一个不需要的缩进。在我使用\ident的每一章中,这会导致问题吗? 如何修复不需要的缩进? 我想保留标准的逐项缩进并只调整第一项。 该文档正在 Overleaf 上进行编辑。

是这样的:

我的目标

这是一个为我复制问题的示例代码:

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage[table,xcdraw]{xcolor}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[toc,page]{appendix}
\usepackage{enumitem}
\usepackage{multirow}
\usepackage{float}
\usepackage[numbers]{natbib}
\usepackage{textcomp}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{commath}
\usepackage{transparent}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\usepackage{adjustbox}
\usepackage[unicode=true,
 bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=1,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false]
 {hyperref}
\hypersetup{pdftitle={Your Title},
 pdfauthor={Your Name},
 pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false}
\makeatletter
\providecommand{\tabularnewline}{\\}
\usepackage[caption=false,font=footnotesize]{subfig} 
\usepackage[caption=false,font=footnotesize]{subfig}
\@ifundefined{showcaptionsetup}{}{%
\PassOptionsToPackage{caption=false}{subfig}}
\usepackage{subfig}
\makeatother

\usepackage{makecell}
\usepackage[official]{eurosym}
\usepackage{comment}
\usepackage{booktabs}

%-----------HEADER AND FOOTER DEFINITION-----------%

\usepackage{fancyhdr}
\renewcommand{\headheight}{0.7in}
\setlength{\headwidth}{\textwidth}
\rhead{% left
\raisebox{0.25in}{\textcolor{gray}{\large Namen}}
}
\lhead{ % right
  % \transparent{0.5}\includegraphics[height=0.6in]{Logo_novo_FEUPbranco.jpg}
}
\pagestyle{fancy}
%\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}




%\usepackage{eurosym}
\usepackage[section]{placeins}

\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}

\makeatletter
\newcommand{\chapterauthor}[1]{%
  {\parindent0pt\vspace*{-5pt}%
  \linespread{1.1}\large\slshape#1%
  \par\nobreak\vspace*{45pt}}
  \@afterheading%
}
\makeatother
\begin{document}

% ------------------ TITLE PAGE -------------------

\begin{titlepage}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here
\setlength{\topmargin}{0in}
\center % Center everything on the page






%---------------------------------------------------------------------------------
%   HEADING SECTIONS
%---------------------------------------------------------------------------------

\textsc{\Large xxxxt }\\[1.5cm] 


\HRule \\[0.4cm]
{ \bfseries \textbf{ title:} Here\\[0.4cm] % Title of your document
\HRule \\[1cm]
}

%----------------------------------------------------------------------
%   AUTHOR SECTION
%----------------------------------------------------------------------


%\begin{minipage}[b][][b]{\linewidth}

\end{titlepage}

% ------------------------------- body --------------------

%%%%%%%%--------- TABLE OF CONTENT ----------%%%%%%%%%%%%%%%

\newpage
\tableofcontents

%%%%%%%%%%-------- ABSTRACT %%%%%%%%%%%%%%%
\newpage
\renewcommand{\abstractname}{Abstract}
\addcontentsline{toc}{section}{Abstract}
\begin{abstract}
  \paragraph{}
  \par  The fu 

\end{abstract}

%%%%%%%%%% INTRODUCTION %%%%%%%%%%%%%%%
\newpage
\section{Introduction} \label{introduction}



\indent 
\par In

\par This report is divided in xx fs:
\begin{itemize}
    \item Chapter 2:
    \item Chapter 3:
    \item Chapter 4:
    \item Chapter 5:
\end{itemize}  

\end{document}

谢谢。

【问题讨论】:

  • 你能加个minimal working example (MWE)吗?这不是默认行为。
  • 这只发生在我写在 \section 内时,如果我在 \subsection 内写它就不会发生。我尝试为整个项目定义缩进,但它解决了问题。
  • @samcarter 我已在导致我的问题的部分中添加了我正在使用的所有代码。希望现在更清楚了
  • 请制作一个可编译的 MWE,而不仅仅是一个代码片段。如果您在创建 MWE 时需要帮助,请点击我第一条评论中的链接。
  • \documentclass{article} \begin{document} \newpage \section{Introduction} \indent \par Text starts \par more text \begin{itemize} \item Chapter 2: \item Chapter 3: \item Chapter 4: \item Chapter 5: \end{itemize} \end{document} 工作得很好,我们真的需要一些代码来复制问题

标签: latex


【解决方案1】:

这个问题与 itemization 完全无关,你甚至不应该知道 itemization 的样子。 abstract 环境中不能有 \paragraph{}。这将导致错误:

永远不要忽略错误!

如果仍然存在错误,甚至不要查看可能是或可能不是有效的 pdf 文件!

在错误 tex 仅恢复到足以对文档的其余部分进行语法检查后,它不会尝试产生合理的输出。


其他问题:

  • hyperref 应该作为最后一个包之一加载

  • \center 只是偶然起作用,最好使用\centering

  • TeX 旨在分离布局和内容。事实上,您必须在文本中弄乱格式说明,例如\indent\parshould tell you that there is something fundamentally wrong. For example if the first paragraph of a section should be indented, use theindentfirst` 包。


\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage[table,xcdraw]{xcolor}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[toc,page]{appendix}
\usepackage{enumitem}
\usepackage{multirow}
\usepackage{float}
\usepackage[numbers]{natbib}
\usepackage{textcomp}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{commath}
\usepackage{transparent}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\usepackage{adjustbox}
\usepackage{indentfirst}

\makeatletter
\providecommand{\tabularnewline}{\\}
\usepackage[caption=false,font=footnotesize]{subfig} 
\usepackage[caption=false,font=footnotesize]{subfig}
\@ifundefined{showcaptionsetup}{}{%
\PassOptionsToPackage{caption=false}{subfig}}
\usepackage{subfig}
\makeatother

\usepackage{makecell}
\usepackage[official]{eurosym}
\usepackage{comment}
\usepackage{booktabs}

\usepackage[unicode=true,
 bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=1,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=false]
 {hyperref}
\hypersetup{pdftitle={Your Title},
 pdfauthor={Your Name},
 pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false}

%-----------HEADER AND FOOTER DEFINITION-----------%

\usepackage{fancyhdr}
\renewcommand{\headheight}{0.7in}
\setlength{\headwidth}{\textwidth}
\rhead{% left
\raisebox{0.25in}{\textcolor{gray}{\large Namen}}
}
\lhead{ % right
  % \transparent{0.5}\includegraphics[height=0.6in]{Logo_novo_FEUPbranco.jpg}
}
\pagestyle{fancy}
%\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}




%\usepackage{eurosym}
\usepackage[section]{placeins}

\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}

\makeatletter
\newcommand{\chapterauthor}[1]{%
  {\parindent0pt\vspace*{-5pt}%
  \linespread{1.1}\large\slshape#1%
  \par\nobreak\vspace*{45pt}}
  \@afterheading%
}
\makeatother
\begin{document}

% ------------------ TITLE PAGE -------------------

\begin{titlepage}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here
\setlength{\topmargin}{0in}
\centering % Center everything on the page






%---------------------------------------------------------------------------------
%   HEADING SECTIONS
%---------------------------------------------------------------------------------

\textsc{\Large xxxxt }\\[1.5cm] 


\HRule \\[0.4cm]
{ \bfseries \textbf{ title:} Here\\[0.4cm] % Title of your document
\HRule \\[1cm]
}

%----------------------------------------------------------------------
%   AUTHOR SECTION
%----------------------------------------------------------------------


%\begin{minipage}[b][][b]{\linewidth}

\end{titlepage}

% ------------------------------- body --------------------

%%%%%%%%--------- TABLE OF CONTENT ----------%%%%%%%%%%%%%%%

\newpage
\tableofcontents

%%%%%%%%%%-------- ABSTRACT %%%%%%%%%%%%%%%
\newpage
\renewcommand{\abstractname}{Abstract}
\addcontentsline{toc}{section}{Abstract}
\begin{abstract}
%  \paragraph{}
    The fu 
\end{abstract}

%%%%%%%%%% INTRODUCTION %%%%%%%%%%%%%%%
\newpage
\section{Introduction} \label{introduction}

In

This report is divided in xx fs:
\begin{itemize}
    \item Chapter 2:
    \item Chapter 3:
    \item Chapter 4:
    \item Chapter 5:
\end{itemize}  

\end{document}

【讨论】:

  • 在类似的情况下为我工作,第一个项目没有标识
猜你喜欢
  • 1970-01-01
  • 2018-10-17
  • 1970-01-01
  • 2015-02-16
  • 1970-01-01
  • 2014-02-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多