Text FormattingStop every paragraph from indenting in leftbar environment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Stop every paragraph from indenting in leftbar environment

Post by ptrcao »

In leftbar environment, it seems every paragraph is automatically indented, which isn't appropriate for all paragraphs except the lead paragraph.

How can I restore the usual behaviour of paragraphs whereby only the lead paragraph is indented? Thanks.

Min. example:

Code: Select all

\documentclass[12pt,a4paper,english]{article}

\usepackage{framed}


\begin{document}


\section*{Q5a} 


{\bf Why is the data paired?  How many soil samples would be required if you wanted to conduct and independent samples t-test to test whether the two machines differed?}\\

\begin{leftbar}
{\bf Ans:} The data are paired because each pair uses the same soil sample and so they are not independent of each other.  An enabling assumption of the two-sample t test is that the two samples are independent of each other, and so the two-sample t test is not appropriate for this experimental design.\\

20 (twice as many) unique soil samples would be needed if you wanted to conduct an independent samples sample t-test with the same degree of power.\\

In the context of this experiment, it also makes sense to use a paired samples design as it allows for direct comparison of measurements by the two machines.  A related advantage is that between-sample variability doesn't enter into the data being analysed, although this issue is addressed by using a large sample size with the two sample t test because such extraoneous variability balances out over large samples.  However, it is often precisely because of the unavailability of samples in large numbers that a paired design is used.
\end{leftbar}

\end{document}
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Stop every paragraph from indenting in leftbar environment

Post by Stefan Kottwitz »

Hi ptrcao,

you could set \parindent to zero:

Code: Select all

\setlength{\parindent}{0pt}
Do it in the preamble, to affect the whole document.

There are several issues in your document that can be improved:
  • \bf is an obsolete LaTeX 2.09 command. Better use \bfseries or \textbf{...}.
  • Don't use \\ to produce space between paragraph. \\ is for line breaks. The empty line cares for the space. Just set \parskip to a value like I did with \parindent above, let's say \setlength{\parskip}{\baselineskip}
  • Even better, use the parskip package or a class with parskip support, such as KOMA-Script classes.
  • The option english is not very useful without babel.
Improved code:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{framed}
\usepackage{parskip}
\begin{document}
\section*{Q5a} 
\textbf{Why is the data paired?  How many soil samples would be required if you wanted to conduct and independent samples t-test to test whether the two machines differed?}
\begin{leftbar}
\textbf{Ans:} The data are paired because each pair uses the same soil sample and so they are not independent of each other.  An enabling assumption of the two-sample t test is that the two samples are independent of each other, and so the two-sample t test is not appropriate for this experimental design.

20 (twice as many) unique soil samples would be needed if you wanted to conduct an independent samples sample t-test with the same degree of power.

In the context of this experiment, it also makes sense to use a paired samples design as it allows for direct comparison of measurements by the two machines.  A related advantage is that between-sample variability doesn't enter into the data being analysed, although this issue is addressed by using a large sample size with the two sample t test because such extraoneous variability balances out over large samples.  However, it is often precisely because of the unavailability of samples in large numbers that a paired design is used.
\end{leftbar}
\end{document}
Stefan
LaTeX.org admin
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Stop every paragraph from indenting in leftbar environment

Post by ptrcao »

Stefan_K wrote:Hi ptrcao,

you could set \parindent to zero:

Code: Select all

\setlength{\parindent}{0pt}
Do it in the preamble, to affect the whole document.

Stefan
Hi Stef,
It works but I still would like the first paragraph to be automatically indented, you know, like the standard behaviour of paragraphs in the general document.

Thanks,
Peter
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Stop every paragraph from indenting in leftbar environme

Post by Stefan Kottwitz »

Hi Peter,

the standard behaviour of paragraphs is that all are indented, possibly except the one following a heading. We speak about paragraphs, which doesn't mean lines.

However, you may use \noindent at the beginning of paragraphs if desired.

Stefan
LaTeX.org admin
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Stop every paragraph from indenting in leftbar environment

Post by ptrcao »

Stefan_K wrote:Hi Peter,

the standard behaviour of paragraphs is that all are indented, possibly except the one following a heading. We speak about paragraphs, which doesn't mean lines.

However, you may use \noindent at the beginning of paragraphs if desired.

Stefan
Ah, yes, so I see. Thanks for correcting me. :D

PS. I use \bf because it's shorter to type, why are the more recent commands longer to type? People want to do less work, not more! :|

PPS. I don't even know why english is there and what it's for; I must've unthinkingly copied and pasted it in from somewhere. :|

PPPS. \parskip is a good idea. Thanks. :D
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
Post Reply