如何删除 LaTex 中摘要的左右缩进?

如何删除 LaTex 中摘要的左右缩进?

我想删除 LaTex 中摘要的缩进。请参阅我的代码:

\documentclass[letterpaper,11pt,twoside,openright]{article}
\usepackage[sumlimits,]{amsmath}
\usepackage{mathptmx}
\usepackage[margin=0.8in]{geometry}
\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
\usepackage{setspace}
\onehalfspacing

\setlength{\parindent}{0mm}
\setlength{\parskip}{1em}
\usepackage[hidelinks,bookmarks=true]{hyperref}
\usepackage[numbered]{bookmark}

\makeatletter
\newcommand*{\sectionbookmark}[1][]{%
  \bookmark[%
    level=section,%
    dest=\@currentHref,%
    #1%
  ]%
}
\makeatother
\usepackage{abstract}

\renewenvironment{abstract}
{\begin{quote}
\noindent\rule{\linewidth}{.5pt}\par{\bfseries \abstractname:}\newline}
{\medskip\noindent\rule{\linewidth}{.5pt}
\end{quote}
}

\setlength{\absleftindent}{0pt}
\setlength{\absrightindent}{0pt}

\begin{document}
\title{Notes for XYZ Analysis}
\author{XYZ}
\date{March 31, 2020}
\maketitle

\begin{abstract}
This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract.\\
\newline
\textbf{Keywords: } {probability, reliability, Monte Carlo.}\newline
\end{abstract}


\section{Introduction}
This is a test. $\mu$That is an abstract. This is a test. That is an abstract. This is a test. That is an abstoiract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is introduction.

\end{document}

左和右

答案1

因为你abstract无论如何都要重新定义环境,所以使用/加载abstract包裹。那么,不要使用quote环境,这是从边距设置内容的原因。

在此处输入图片描述

\documentclass{article}

\usepackage{mathptmx}

\renewenvironment{abstract}
  {\par\rule{\linewidth}{.5pt}\par%
   {\bfseries \abstractname:}\par}
  {\par\rule{\linewidth}{.5pt}}

\setlength{\parindent}{0pt}

\begin{document}

\title{Notes for XYZ Analysis}
\author{XYZ}
\date{March 31, 2020}
\maketitle

\begin{abstract}
This is a test. That is an abstract. This is a test. That is an abstract. 
This is a test. That is an abstract. This is a test. That is an abstract. 
This is a test. That is an abstract. This is a test. That is an abstract.

\medskip

\textbf{Keywords: }probability, reliability, Monte Carlo.
\end{abstract}


\section{Introduction}
This is a test. $\mu$That is an abstract. This is a test. That is an abstract. This is a test. That is an abstoiract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is introduction.

\end{document}

答案2

quoting软件包中有可以执行此操作的工具:

\documentclass[letterpaper,11pt,twoside,openright]{article}
\usepackage[sumlimits,]{amsmath}
\usepackage{mathptmx}
\usepackage[margin=0.8in]{geometry}
\usepackage{quoting}
\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
\usepackage{setspace}
\onehalfspacing

\setlength{\parindent}{0mm}
\setlength{\parskip}{1em}
\usepackage[hidelinks,bookmarks=true]{hyperref}
\usepackage[numbered]{bookmark}

\makeatletter
\newcommand*{\sectionbookmark}[1][]{%
  \bookmark[%
    level=section,%
    dest=\@currentHref,%
    #1%
  ]%
}
\makeatother

\renewenvironment{abstract}%
 {\begin{quoting}[leftmargin=0pt, rightmargin=0pt, begintext=\rule{\linewidth}{0.5pt}\newline\textbf{\abstractname: } \newline, endtext=\rule{\linewidth}{0.5pt}]}
 {\end{quoting}}

\begin{document}
\title{Notes for XYZ Analysis}
\author{XYZ}
\date{March 31, 2020}
\maketitle

\begin{abstract}
This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract.\\
\newline
\textbf{Keywords: } {probability, reliability, Monte Carlo.}\newline
\end{abstract}


\section{Introduction}
This is a test. $\mu$That is an abstract. This is a test. That is an abstract. This is a test. That is an abstoiract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is a test. That is an abstract. This is introduction.

\end{document} 

在此处输入图片描述

相关内容