\setlength\parindent{0.5in} は文書に改行を追加します

\setlength\parindent{0.5in} は文書に改行を追加します

私は使用していますミリ13そして xelatex を使用して MLA 形式の文書を作成します。教授から論文を左揃えにするよう指示されたので、\raggedright を使用してこれを実現しています。これにより段落のインデントが削除されることが分かりましたが、MLA 形式の文書では段落をインデントする必要があるため、\setlength\parindent{0.5in} を使用して再設定する必要もあります。私が遭遇している問題は、これによって文書に改行が追加されることです。

次に例を示します。

\documentclass{article}
\usepackage{mla13}
\title{Sample Sources MLA13 Document}
\firstname{John}
\lastname{Smith}
\professor{Dr. Professor}
\class{FunClass}

\raggedright
\begin{document}
\makeheader
\setlength\parindent{0.5in}

In a recent report by the United Nations, they found that more than 884 million people do not have 
access to safe drinking water \cite[e.g.][15-23]{unWater}. This number equates to more than 1 out 
of every 8 people, not having access to something that is so vital to human life. Knowing this 
fact, most must ask themselves, why the same water that we drink is used to clean our toilets and 
wash our lawns. The water that hundreds of millions of people would love to have, is something that 
we just flush down the toilet. This paper intends to examine the benefits of grey water systems, 
and how their use leads to increased water conservation efforts, creating more benefits then costs.

Grey water systems are a technique that aids in water conservation efforts by reusing water that 
doesn't need to be fully cleaned. For example, many grey water systems use the water that comes 
from the shower drain to water the lawn or fill the toilet. Even though this water isn't going to a 
water treatment plant, doesn't mean that it is not clean. Grey water systems are equipped with a 
filter that removes most soaps and solid objects that make their way through the drainage system 
\cite{planetArk}. With a private market for greywater systems developing, there are a variety of 
commercial systems that filter water to ``remove hair, lint, and debris, and remove pollutants, 
bacteria, salts'' and many more materials \cite{pacificInst2010}

\end{document}

レンダリングされたドキュメントは次のとおりです...

インデント付きの文書

以下は、行のないドキュメントです\setlength\parindent{0.5in}。タイトルの後の改行が消えていることに注目してください。この原因は何でしょうか?明確に言うと、私が実現しようとしているのは、余分な改行なしで段落のインデントを実現することです。ありがとう!

インデントなしの文書

答え1

%最も簡単な解決策は、コマンドの後にを追加することです\setlength。これは、インデント コマンドの後の空白行が新しい段落として扱われますが、\makeheaderコマンドの後では無視されるためです。末尾に を追加すると%、空白行が効果的に削除されます。詳細については、この質問を参照してください。

\documentclass{article}
\usepackage{mla13}
\title{Sample Sources MLA13 Document}
\firstname{John}
\lastname{Smith}
\professor{Dr. Professor}
\class{FunClass}
\raggedright


\begin{document}
\makeheader
\setlength\parindent{0.5in}%

In a recent report by the United Nations, they found that more than 884 million people do not have 
access to safe drinking water \cite[e.g.][15-23]{unWater}. This number equates to more than 1 out 
of every 8 people, not having access to something that is so vital to human life. Knowing this 
fact, most must ask themselves, why the same water that we drink is used to clean our toilets and 
wash our lawns. The water that hundreds of millions of people would love to have, is something that 
we just flush down the toilet. This paper intends to examine the benefits of grey water systems, 
and how their use leads to increased water conservation efforts, creating more benefits then costs.

Grey water systems are a technique that aids in water conservation efforts by reusing water that 
doesn't need to be fully cleaned. For example, many grey water systems use the water that comes 
from the shower drain to water the lawn or fill the toilet. Even though this water isn't going to a 
water treatment plant, doesn't mean that it is not clean. Grey water systems are equipped with a 
filter that removes most soaps and solid objects that make their way through the drainage system 
\cite{planetArk}. With a private market for greywater systems developing, there are a variety of 
commercial systems that filter water to ``remove hair, lint, and debris, and remove pollutants, 
bacteria, salts'' and many more materials \cite{pacificInst2010}

\end{document}

出力

答え2

\setlength\parindent{0.5in}適切な場所、つまり の前に追加します\begin{document}

\documentclass{article}
\usepackage{mla13}
\title{Sample Sources MLA13 Document}
\firstname{John}
\lastname{Smith}
\professor{Dr. Professor}
\class{FunClass}

\raggedright
\setlength\parindent{0.5in}

\begin{document}
\makeheader

In a recent report by the United Nations, they found that more than 884 million people do not have 
access to safe drinking water \cite[e.g.][15-23]{unWater}. This number equates to more than 1 out 
of every 8 people, not having access to something that is so vital to human life. Knowing this 
fact, most must ask themselves, why the same water that we drink is used to clean our toilets and 
wash our lawns. The water that hundreds of millions of people would love to have, is something that 
we just flush down the toilet. This paper intends to examine the benefits of grey water systems, 
and how their use leads to increased water conservation efforts, creating more benefits then costs.

Grey water systems are a technique that aids in water conservation efforts by reusing water that 
doesn't need to be fully cleaned. For example, many grey water systems use the water that comes 
from the shower drain to water the lawn or fill the toilet. Even though this water isn't going to a 
water treatment plant, doesn't mean that it is not clean. Grey water systems are equipped with a 
filter that removes most soaps and solid objects that make their way through the drainage system 
\cite{planetArk}. With a private market for greywater systems developing, there are a variety of 
commercial systems that filter water to ``remove hair, lint, and debris, and remove pollutants, 
bacteria, salts'' and many more materials \cite{pacificInst2010}

\end{document}

ここに画像の説明を入力してください

この恥ずべき組版を見ると目から血が出てきます。

なぜ空白行が追加されるのでしょうか?\makeheaderコマンドは で終わり\end{nospacecenter}、これは次のように定義されます。

\newenvironment{nospacecenter}
  {\parskip=0pt\par\nopagebreak\centering}
  {\par\noindent\ignorespacesafterend}

\makeheaderそのため、TeX は作業が完了すると新しい段落をタイプセットします。

もちろん、削除するのが\noindent\ignorespacesafterend正しい定義になります。

\newenvironment{nospacecenter}
  {\parskip=0pt\par\nopagebreak\centering}
  {\par}

より良い定義は

\newenvironment{nospacecenter}
  {\parskip=0pt\topsep=0pt \trivlist\listparindnt=0pt \item\relax\centering}
  {\endtrivlist}

この方法では、後に空行があると\end{nospacecenter}インデントが追加され、空行がない場合はインデントが追加されません。

また、\makeheader修正すべき点:

\newcommand*{\makeheader}{%
  \begingroup
  \parindent\z@
  \rmfamily
  \@firstname\ \@lastname\\
  \@professor\\
  \@class\\
  \datef\@date
  \begin{nospacecenter}
  \@title
  \end{nospacecenter}
  \endgroup
}

変更を加えた完全な例を以下に示します (nospacecenterテスト用の環境も追加しました)。

\documentclass{article}
\usepackage{mla13}
\title{Sample Sources MLA13 Document}
\firstname{John}
\lastname{Smith}
\professor{Dr. Professor}
\class{FunClass}

% Fix some wrong bits in mla13.sty
\makeatletter
\renewcommand*{\makeheader}{%
  \begingroup
  \parindent\z@
  \rmfamily
  \@firstname\ \@lastname\\
  \@professor\\
  \@class\\
  \datef\@date
  \begin{nospacecenter}
  \@title
  \end{nospacecenter}
  \endgroup
}
\renewenvironment{nospacecenter}
  {\parskip=\z@\topsep=\z@\trivlist\listparindent\z@
  \item\relax\centering}
  {\endtrivlist}
\makeatletter

\raggedright
\setlength\parindent{0.5in}

\begin{document}
\makeheader

In a recent report by the United Nations, they found that more than 884 million people do not have 
access to safe drinking water \cite[e.g.][15-23]{unWater}. This number equates to more than 1 out 
of every 8 people, not having access to something that is so vital to human life. Knowing this 
fact, most must ask themselves, why the same water that we drink is used to clean our toilets and 
wash our lawns. The water that hundreds of millions of people would love to have, is something that 
we just flush down the toilet. This paper intends to examine the benefits of grey water systems, 
and how their use leads to increased water conservation efforts, creating more benefits then costs.
\begin{nospacecenter}
abc
\end{nospacecenter}
Grey water systems are a technique that aids in water conservation efforts by reusing water that 
doesn't need to be fully cleaned. For example, many grey water systems use the water that comes 
from the shower drain to water the lawn or fill the toilet. Even though this water isn't going to a 
water treatment plant, doesn't mean that it is not clean. Grey water systems are equipped with a 
filter that removes most soaps and solid objects that make their way through the drainage system 
\cite{planetArk}. With a private market for greywater systems developing, there are a variety of 
commercial systems that filter water to ``remove hair, lint, and debris, and remove pollutants, 
bacteria, salts'' and many more materials \cite{pacificInst2010}

\end{document}

ここに画像の説明を入力してください

関連情報