Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

with the following code my paragraphs aren't automatically indenting... I'm confused as to why because I've done a decent bit of LaTeXing before with very similar packages and with the same article class yet it's always done it for me automatically after two returns. Here's the .tex file code:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage[greek,english]{babel}
\usepackage{color}
\usepackage{listings}
\usepackage{float}


\begin{document}

\flushleft{
name\\
class\\
12.11.12\\
\section*{Radix Trees}
}

\subsection*{Introduction}

adfkhjasdhfashdfkj akdjsfhkashdfkja.

just gibberish, adfsjhakjsdfhkjasdf askdfhjkashfd

test sakdfhaijsfdhkjsf

\end{document}  

I'm sure I'm missing something obvious, I know the first para won't indent but as to why the second two don't I have no idea. They get a newline but no indent. Any help would be much appreciated, thanks.

share|improve this question
    
Perhaps you could edit your question so as to make the title more explicit, now that an answer has been found. I am sure other people might have similar issues. –  ienissei Dec 7 '12 at 8:04

2 Answers 2

up vote 4 down vote accepted

\flushleft is not a command that takes arguments. The way you have it written everything (the entire document) after the command is flushed left. To get what you want you should write the following

{\flushleft name\\ class\\ 12.11.12} \section*{Radix Trees}

that is set the command and the text to be flushed withing curly braces.

share|improve this answer
    
Awesome, thanks very much! –  Noah Dec 6 '12 at 18:35
    
@Noah Notice that I took the liberty and improved the code a bit more. –  tohecz Dec 6 '12 at 18:39
2  
And please notice that instead of \flushleft, the command \noindent could be used here, because in this case, the only effect of \flushleft is suppressing the indentation. –  tohecz Dec 6 '12 at 18:39
3  
Don't use \flushleft by itself; in this application use either \raggedright (with a finishing \par before the closing brace) or enclose the text in the flushleft environment (which adds some space above and below it). –  egreg Dec 6 '12 at 18:55
    
@egreg, \begin{flushleft} calls \flushleft inside a brace group, so the space inserted above will be exactly the same. Still, it is of course better to delimit the scope of flushleft by calling it as an environment (which also ensures that \endflushleft will be called, if it exists, for spacing below). –  alexis Dec 6 '12 at 21:14

As others have commented, \flushleft is not a command with arguments (like, for instance, \textbf or \emph).

Actually \flushleft is not a user command at all. It exists only for internal reasons, for making the flushleft environment work.

You have many possibilities for setting the author data for a document that seems not to require the full fledged \maketitle.

In what follows I assume that code snippets are preceded by your preamble (slightly modified)

\documentclass[12pt]{article}
\usepackage[greek,english]{babel}
\usepackage{graphicx}
\usepackage{amsmath,amssymb}
\usepackage{color}
\usepackage{listings}
\usepackage{float}

\setcounter{secnumdepth}{-2} % no section number

First way

\begin{document}

\noindent name

\noindent class

\noindent date

\section{Radix Trees}

Second way

Here the result is the same as in the preceding way, but the code is more compact

\begin{document}

{\raggedright
 name \\
 class \\
 date \\
}

\section{Radix Trees}

Third way

This may add some space below the data. Ordinarily, the flushleft environment adds also vertical space above it, but here we are at the top of a page, so this space will be discarded. Actually, also the space below will not be added, in this case, because a section title follows and LaTeX chooses the maximum between the predefined spaces below the environment and above the section title.

\begin{document}

\begin{flushleft}
name \\
class \\
date
\end{flushleft}

\section{Radix Trees}

Fourth (and preferred) way

\newcommand{\authordata}[3]{{\raggedright #1\\#2\\#3\par}}

\begin{document}

\authordata
  {name}
  {class}
  {date}

\section{Radix Trees}

Why is the fourth way my preferred one?

This way abstracts the input of the data, so you're free to change how it will appear by just changing the definition. For instance a simple addition of \large\bfseries will make the data more prominent:

\newcommand{\authordata}[3]{{\large\bfseries\raggedright #1\\#2\\#3\par}}

Many variations are possible, without ever touching what is after \begin{document}.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.