6

Is there a way to exlude certain lines from indentation ? For example, I'd like to have every line that starts with a certain object, like the \Longrightarrow in the following MWE, to not be indented. Is there a way to do this without adding \noindent at the start of every such line ?

The command should be robust so as to also permit other identifier of such lines than mathematical symbols: More concretely it should be possible to have the option to also indent lines consisting of a sole LaTeX command (like \textcyr{\char143}) lines starting with a \fbox.

I'd be grateful for every tip!!

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}

The indentation is visible in this line, as one can see by type a lot of text text text text text text text text text text text text text text text ...

$\Longrightarrow$ Because I used the arrow at the start, this line should *never* be intended.

Now indentation is active again...

\end{document}
  • 1
    The Longrightarrow is tricky as you are already in math mode. But other macros that are not in math mode can be redefined as \let\OlfFbox\fbox and \def\fbox{\noindent\OlfFbox}. Then using \fbox will automatically not be indented. If you are willing to use \Longrightarrow instead of $\Longrightarrow$, then you can use \let\OldLongrightarrow\Longrightarrow and \def\Longrightarrow{\noindent\ensuremath{\OldLongrightarrow}}. – Peter Grill Dec 12 '14 at 18:14
  • Actually this comment was, what I was really looking for, since I already have several lines that are to be intendet and don't want to change the command of each line to some new command that I define to not be indented, but rather redefine the command (but the answerer couldn't know that of course, since I wasn't precise about this point). – l7ll7 Dec 13 '14 at 17:07
5
+100

You have to avoid starting math mode, or it would be too late for removing the indentation:

\documentclass[12pt,a4paper]{article}

\newcommand{\niLongrightarrow}{%
  \noindent\ensuremath{\Longrightarrow}%
}

\begin{document}

The indentation is visible in this line, as one can see by type a lot of text text text 
text text text text text text text text text text text text ...

\niLongrightarrow{} Because I used the arrow at the start, this line should *never* be 
intended.

Now indentation is active again and $a\niLongrightarrow b$...

\end{document}

enter image description here

But using \noindent is simpler.

  • Is there any drawback to redefining the original as \let\svLRA\Longrightarrow\def\Longrightarrow{\noindent\ensuremath{\svLRA}}, in case the OP wanted to not introduce a new macro name? – Steven B. Segletes Dec 13 '14 at 0:54
  • 1
    @StevenB.Segletes Yes, there are: the symbol is not used in its mathematical meaning, in this case, but just as a graphic device. I used \ensuremath for convenience, but \ensureNONmath would be better. – egreg Dec 13 '14 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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