Text Formattingline break makes space at start of \noindent environments

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
johnjamessmith0
Posts: 37
Joined: Sun Mar 29, 2009 1:41 am

line break makes space at start of \noindent environments

Post by johnjamessmith0 »

I just discovered this, and I anticipate that there won't be any solution. If you have this:

Code: Select all

\documentclass{article}

\newenvironment{thingy}{\noindent}{}

\begin{document}

\begin{thingy}
testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing testing
\end{thingy}

\end{document}
You get this space at the start of the first line, even with the \noindent. True, the space goes away if you just the paragraph on the same line in the code as the \begin, but is there any way to get rid of the space without going back through all one's code? I can imagine that this might be extremely annoying in some situations.
Last edited by johnjamessmith0 on Fri Aug 27, 2010 9:53 pm, edited 1 time in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

line break makes space at start of \noindent environments

Post by gmedina »

Hi,

use \ignorespaces:

Code: Select all

\newenvironment{thingy}{\noindent\ignorespaces}{}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
johnjamessmith0
Posts: 37
Joined: Sun Mar 29, 2009 1:41 am

Re: line break makes space at start of \noindent environmen

Post by johnjamessmith0 »

Haha, thanks. I love it when I get forum answers to questions that aren't easily searched. And I hope it's not bad etiquette around here to make a post just to thank someone.

EDIT: All right, I just read the Board Rules and it seems like this is bad etiquette. Whoops!
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

line break makes space at start of \noindent environments

Post by gmedina »

johnjamessmith0 wrote:Haha, thanks. I love it when I get forum answers to questions that aren't easily searched. And I hope it's not bad etiquette around here to make a post just to thank someone.
You're welcome. I don't think that thanking someone can be considered as bad etiquette
johnjamessmith0 wrote:EDIT: All right, I just read the Board Rules and it seems like this is bad etiquette. Whoops!
As I said before, I don't think that it is inappropriate and now that you've marked the problem as solved everything is OK.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

line break makes space at start of \noindent environments

Post by localghost »

johnjamessmith0 wrote:[…] EDIT: All right, I just read the Board Rules and it seems like this is bad etiquette. Whoops!
Please tell me where you found that and it will be corrected. It is explicitly written in the rules that an expression of gratitude to the author of a solution is taken for granted.


Best regards
Thorsten
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: line break makes space at start of \noindent environmen

Post by frabjous »

Sorry for straying off topic, but I think the line in the Board Rules is just poorly worded. Saying that something "is taken for granted" in English can mean that it doesn't need to be said, but I think what is meant is that it goes without saying that a word of thanks is appreciated.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

line break makes space at start of \noindent environments

Post by localghost »

frabjous wrote:Sorry for straying off topic, but I think the line in the Board Rules is just poorly worded. Saying that something "is taken for granted" in English can mean that it doesn't need to be said, but I think what is meant is that it goes without saying that a word of thanks is appreciated.
That's the problem with the translation of a specific word from one language to another. You sometimes miss the right meaning. I modified that and used another wording. Thanks for this idea.
Post Reply