New MembersSpace between two words of text

You would like to introduce yourself before starting to post? That's a nice idea and here is the forum for you...
Post Reply
Philosophaie
Posts: 17
Joined: Sat Mar 21, 2015 8:59 pm

Space between two words of text

Post by Philosophaie »

How do you put a space between two words of text?

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Re: Space between two words of text

Post by Stefan Kottwitz »

Leave a blank (space) between the words in the source code of the document.

If you don't mean a "normal" space, let us know.

Stefan
LaTeX.org admin
Philosophaie
Posts: 17
Joined: Sat Mar 21, 2015 8:59 pm

Re: Space between two words of text

Post by Philosophaie »

\begin{gather*}
This Word\\
\end{gather*}

prints out in the pdf as

ThisWord

How do you get a space between "This" and "Word"?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Space between two words of text

Post by Johannes_B »

You are in math mode, and as is taught in every introduction, spaces are ignored in math mode. The typeset result you are getting the variables of T and h and i and s ans W and o and r and d multiplied.

You may wanna give away hints on what you want to achieve. Because honestly, your questions seem to contradict themselves and you have kept quite a lot of people busy right now.


And please, why did you once again post in the new members section, when this, as alle posts before where about maths and have been moved there?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Space between two words of text

Post by Stefan Kottwitz »

If you need to use gather*, the correct way would be this way, using amsmath, because of the math mode:

Code: Select all

\documentclass{article} 
\usepackage{amsmath} 
\begin{document} 
\begin{gather*}
\text{This Word}\\
\end{gather*}
\end{document}
If you just need centering of text, you could use center:

Code: Select all

\documentclass{article} 
\usepackage{amsmath} 
\begin{document} 
\begin{center}
This Word\\
\end{center}
\end{document}
Even simpler, if you just would like to switch on centering and keep it, use \centering:

Code: Select all

\documentclass{article} 
\usepackage{amsmath} 
\begin{document} 
\centering
This Word\\
\end{document}
The very first way is using math mode, which removes the spaces, as Johannes said, as a side effect. So I would not use gather for simple text.

Stefan
LaTeX.org admin
Post Reply