1

As can be seen from the MWE below, we define:

\setlength{\parindent}{3em}
\setlength{\parskip}{3em}

wherein parindent will set a horizontal space of 3em before the start of a new paragraph, and parskip will set a vertical space of 3em when going to another paragraph.

One can notice the result is the same when inserting a blank line between two "paragraphs" (see test1), or inserting \endgraf (see test2) or inserting \par (see test3) between them.

As for test4, in which \\ is inserted between the two parts of text (test4a and test4b), this is not interpreted as a "new paragraph" as one can notice that the second line (test4b) received neither the parindent nor the parskip.

       test4a blablabla
test4b blablabla

My question is: what is the most elegant way to make test5a and test5b which will output something as follows:

       test5a blablabla
       test5b blablabla

That is: to invoke \parindent (the second line also has horizontal indentation of 3em) but not \parskip (so that there is no extra vertical separation of 3em) when going to the next line.

MWE

\documentclass[a2paper, fontsize=24pt]{scrreprt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setlength{\parindent}{3em}
\setlength{\parskip}{3em}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}



test1a blablabla

test1b blablabla
\endgraf



test2 blablabla\endgraf
test2b blablabla
\endgraf



test3a blablabla\par
test3b blablabla
\endgraf



test4a blablabla\\
test4b blablabla

\end{document}

Elegant?

Now, what is meant by elegant in this OP?

I am under the impression of having read that it is a "beginner mistake" to want to make WYSIWYG documents in which the formatting/typesetting is already visually to be seen in the code, isn't it? Or at least to do so "to soon". In any way, for my particular purpose, I think something such as

       test5a blablabla /command
       test5b blablabla

would be ideal, that is to say: the issuing of the command should be as simple as placing /something at the end of the line. The text at which /something wants to be appended shouldn't need to be placed in any further environment visible in the "body" of the code. Of course it is possible to define the /command in the "head" of the code. The "smallest" or "most readable" definition will win.

Why?

See why I want to use this for example in this PDF view here or download here. At page 3, where it says 二: there are indentations which I don't need.

  • Why don't you not set parskip to 3em if you don't want any extra space? – cfr Oct 12 '17 at 4:10
  • Are you interested in line breaks across the page within your blablabla? That is, could you provide more information on the use case of this? It may affect the possible solutions. Also, there is no "most elegant" way, since that's very subjective. – Werner Oct 12 '17 at 4:34
  • @Werner There will be no line-breaks within the dummy blablabla. – Vincent Mia Edie Verheyen Oct 12 '17 at 4:37
  • @Werner There will be no line-breaks within the dummy blablabla unless those of the same kind. For example blablabla BREAK blablabla BREAK blablabla is possible. With BREAK referring to the kind of line-break is asked for in the OP. – Vincent Mia Edie Verheyen Oct 12 '17 at 4:49
  • 1
    @VincentMiaEdieVerheyen You're taking the wrong path, but that's just my opinion. – egreg Oct 12 '17 at 7:08
2

You can use the following definition of \fakepar:

enter image description here

\documentclass{article}

\setlength{\parindent}{3em}
\setlength{\parskip}{3em}

\newcommand{\fakepar}{\mbox{}\\\hspace*{\parindent}}

\begin{document}

% Test 1
Lorem ipsum 1a \ldots

Lorem ipsum 1b \ldots

% Test 2
Lorem ipsum 2a \ldots \par
Lorem ipsum 2b \ldots

% Test 3
Lorem ipsum 3a \ldots \endgraf
Lorem ipsum 3b \ldots

% Test 4
Lorem ipsum 4a \ldots \\
Lorem ipsum 4b \ldots

% Test 5
Lorem ipsum 5a \ldots \fakepar
Lorem ipsum 5b \ldots

\end{document}

\fakepar ensures that something is set - \mbox{} - before inserting a line break - \\ - and forcing a regular paragraph indent - \hspace*{\parindent}.

3

I see no reason whatsoever for setting a nonzero \parindent when \parskip is nonzero (I see no reason for setting \parskip, except in business letters, actually).

I see no reason either for having “special paragraphs” that are not detached from the previous one, if you choose to set a nonzero parskip.

But the customer's always right, so here is a possible solution, I leave it to you to find where it could go wrong.

\documentclass[a4paper]{scrreprt}

\newcommand{\parnoskip}{%
  \par\begingroup\edef\x{\endgroup
    \everypar={\the\everypar\noexpand\setlength{\parskip}{\the\parskip}}%
  }\x
  \parskip=0pt
}
%
\setlength{\parindent}{3em}
\setlength{\parskip}{3em}
%

\newcommand{\bla}{some text some text some text some text some text}
\newcommand{\blablabla}{\bla\bla\bla}

\begin{document}

test1a \blablabla

test1b \blablabla

test2 \blablabla\par
test2b \blablabla

test3a \blablabla\parnoskip
test3b \blablabla\parnoskip

test3c \blablabla

\parnoskip

test3d \blablabla

test4a \blablabla

\end{document}

As you see, \parnoskip can go next to the last word of a paragraph, but also between paragraphs and it can be followed by a blank line.

Don't use \endgraf in your documents, except perhaps in some command definition, but never ever in the body.

enter image description here

1

If there are more lines placed together then placing \command at the end of each line is somewhat impractical. So, IMHO more elegant is to define environment:

\def\verse{\begingroup \obeylines \parskip=0pt \relax}
\def\endverse{\par\endgroup}

\verse
first line
second line
next line
last line
\endverse

\bye
  • verse is already defined in LaTeX. Choose another name. – Peter Wilson Oct 12 '17 at 18:49
  • This is not my problem, this is problem of LaTeX. I don't use it. – wipet Oct 12 '17 at 18:57
  • But the questioner does use LaTeX (see the MWE) . If your answer is used in the questioner's (or other's) LaTeX documents then there is a possibility of problems. – Peter Wilson Oct 13 '17 at 18:25

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.