Text FormattingAlignment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Super
Posts: 5
Joined: Wed Jun 11, 2014 11:07 pm

Alignment

Post by Super »

How do you do these kinds of things, where you have something in the left and then something in the center:

(1) (insert space here) 1/2=0.5

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Alignment

Post by Johannes_B »

Wow, your question is very very unspecific. If you want to align parts of an equation, use the align-environment provided by amsmath.

But somehow i sense you just want to number your equation. You can have the equation number on the left using the option leqno.

Code: Select all

\documentclass[leqno]{article}
\usepackage{mathtools}%loads amsmath and provides some patches
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{equation}
	\frac{1}{2} = 0.5
\end{equation}

\blindtext
\begin{gather}
	\frac{1}{2} = 6 \\
	\frac{1}{3} = 4 \label{eq:thirdb12}\\
	\frac{1}{4} = 3 \\
	\frac{1}{6} = 2 
\end{gather}

See \eqref{eq:thirdb12}

\end{document}
Hint: you can click on »Open in writelatex« just above the code to see the output.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Super
Posts: 5
Joined: Wed Jun 11, 2014 11:07 pm

Re: Alignment

Post by Super »

Thanks!

Also, how do you make it so that there's lower case roman numeral letters on the left, and then regular text on the right, and also it indents so that the text won't go under the roman numeral?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Alignment

Post by Johannes_B »

Again, i can only guess. I suppose you are looking for an enumerated list, tweaked to count with roman numerals.

Code: Select all

\documentclass{article}
\usepackage{enumitem}
\usepackage{blindtext}
\begin{document}
\begin{enumerate}[label=\roman*]
	\item i am an item
	\item i am another one
	\item i am a very long one \blindtext
\end{enumerate}
\end{document}

Please, please, read some introductory material. For example LaTeX for complete novices by Nicola Talbot.

This gives you a good starting point.


For further questions, please be more specific and try to run a basic google search.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Super
Posts: 5
Joined: Wed Jun 11, 2014 11:07 pm

Re: Alignment

Post by Super »

How do you put a parentheses around the roman numeral?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Alignment

Post by Johannes_B »

Be a bit creative ;-)

Code: Select all

\begin{enumerate}[label=(\roman*)]
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Super
Posts: 5
Joined: Wed Jun 11, 2014 11:07 pm

Re: Alignment

Post by Super »

Is there a way so that the roman numeral does not indent, but the text does?

Thanks!
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Alignment

Post by Johannes_B »

Ok, this time i give up. Can you be more specific? Maybe provide a minimal working example just as i did above. I really don't know what you mean.
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
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Alignment

Post by Johannes_B »

?

Code: Select all

\documentclass{article}
\usepackage{enumitem}
\usepackage{blindtext}
\begin{document}
\begin{enumerate}[label=(\roman*),align=left]
        \item i am an item
        \item i am another one
        \item i am a very long one \blindtext
\end{enumerate}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
akhadzhiev
Posts: 3
Joined: Wed Sep 24, 2014 9:15 am

Alignment

Post by akhadzhiev »

Using \hfill won't necessarily result in the middle text being centered, as the example below demonstrates. If you want to place the text in such a way that the middle text is really centered, I would suggest using \parboxes, as the example shows

Code: Select all

\documentclass{article}
\usepackage{lipsum}

\newcommand\textbox[1]{%
  \parbox{.333\textwidth}{#1}%
}

\begin{document}

\noindent Left longer sample simple text\hfill Center?\hfill Right

\noindent\textbox{Left longer sample text\hfill}\textbox{\hfil Center\hfil}\textbox{\hfill Right}

\noindent\lipsum[2]

\end{document}
Post Reply