
Estoy usandomla13y xelatex para crear un documento con formato mla. Mi profesor ha pedido que nuestros trabajos estén alineados a la izquierda, así que estoy usando \raggedright para lograrlo. Descubrí que eso hace que se eliminen las sangrías de los párrafos, pero como los párrafos deben tener sangría en un documento con formato mla, también tengo que restablecerlo con \setlength\parindent{0.5in}. El problema con el que me encuentro es que esto provoca que se agregue una nueva línea al documento.
He aquí un ejemplo:
\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}
Aquí está ese documento renderizado...
A continuación se muestra el documento sin la línea \setlength\parindent{0.5in}
. Observe cómo la nueva línea después del título ha desaparecido. ¿Alguna idea que está causando esto?Para que quede claro, lo que intento lograr es la sangría del párrafo sin la nueva línea adicional.¡Gracias!
Respuesta1
La solución más sencilla es agregar un %
después del \setlength
comando. La razón de esto es que la línea en blanco después del comando de sangría se trata como un párrafo nuevo, pero se ignora después del \makeheader
comando. El final %
elimina efectivamente la línea en blanco. Consulte esta pregunta para obtener más detalles.
\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}
Respuesta2
Agregue \setlength\parindent{0.5in}
donde pertenece, es decir, antes \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}
Me sangran los ojos después de ver esta vergonzosa composición tipográfica.
¿Por qué se agrega una línea en blanco? Bueno, el \makeheader
comando termina con \end{nospacecenter}
, que está definido por
\newenvironment{nospacecenter}
{\parskip=0pt\par\nopagebreak\centering}
{\par\noindent\ignorespacesafterend}
entonces TeX está escribiendo un nuevo párrafo cuando \makeheader
ha terminado de funcionar.
Por supuesto, eliminar \noindent\ignorespacesafterend
sería una definición correcta:
\newenvironment{nospacecenter}
{\parskip=0pt\par\nopagebreak\centering}
{\par}
Una mejor definición sería
\newenvironment{nospacecenter}
{\parskip=0pt\topsep=0pt \trivlist\listparindnt=0pt \item\relax\centering}
{\endtrivlist}
De esta manera, una línea en blanco después \end{nospacecenter}
agregaría sangría, ninguna línea en blanco no lo haría.
También \makeheader
debería arreglarse:
\newcommand*{\makeheader}{%
\begingroup
\parindent\z@
\rmfamily
\@firstname\ \@lastname\\
\@professor\\
\@class\\
\datef\@date
\begin{nospacecenter}
\@title
\end{nospacecenter}
\endgroup
}
Aquí hay un ejemplo completo, con los cambios (también agregué un nospacecenter
entorno para probarlo):
\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}