2

MWE:

\documentclass[12pt,a4paper]{article}
\usepackage{graphicx}

\begin{document}

\section{Some Section}

First (long) paragraph. \\
Second (long) paragraph. \\ 
\input{some_figure}
Third (long) paragraph. \\
Fourth (long) paragraph.

\end{document}

where some_figure.txt contains

\begin{figure}[t]
\includegraphics[width=3cm]{example-image} 
\end{figure}

The linebreak \\ after "Second (long) paragraph." causes an automatic indent in the subsequent line "Third (long) paragraph." as one can see in the following figure.

enter image description here.

Is there a way to (automatically) avoid/disable these indents?

I usually move \input{some_figure} at the beginning/end of a section to circumvent this problem. However, if the text becomes to large, this is not really an option.

  • 2
    Don't use \\ to end paragraphs, but a blank line. – egreg Aug 5 at 16:30
1

If you mean actual "paragraphs", then take egreg's advice ("Don't use \\ to end paragraphs, but a blank line"). But if you are merely forcing linebreaks, then the issue is not one of indent, but of stray spaces.

\documentclass[12pt,a4paper]{article}
\usepackage{graphicx,filecontents}
\begin{filecontents*}{some_figure}
\begin{figure}[t]
\includegraphics[width=3cm]{example-image} 
\end{figure}
\end{filecontents*}

\begin{document}

\section{Some Section}

First (long) paragraph. \\
Second (long) paragraph. \\ 
\input some_figure \unskip
Third (long) paragraph. \\
Fourth (long) paragraph.

\end{document}

enter image description here

Alternately,

\documentclass[12pt,a4paper]{article}
\usepackage{graphicx,filecontents}
\begin{filecontents*}{some_figure}
\begin{figure}[t]
\includegraphics[width=3cm]{example-image} 
\end{figure}
\end{filecontents*}

\begin{document}

\section{Some Section}

First (long) paragraph. \\
Second (long) paragraph.
\input some_figure \\
Third (long) paragraph. \\
Fourth (long) paragraph.

\end{document}

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.