With indentation set to `0em`, when using a line break, there is still an indentation of a size of a space
Problem Description
I am quite a newbie at *TeX, but I defined some newcommands as some kind of paragraph styles (maybe not the proper way to do so, maybe someone could tell me how to accomplish this better).
I want to have default paragraph style with no indentation, space after paragraph should be 0.08", space before paragraph should be 0". However, any of the paragraph style could change any of these settings and some something more (like character styles, e.g. bold, italics, underline, etc).
Now, sometimes I want to insert a paragraph in particular paragraph style without space after that paragraph. For that I use line break (\), which usually does the job. However, with the paragraphStyle below, this is broken.
It seems like if in the first paragraph, there is an indentation of a size of a space, which I cannot elimininate, no matter what I do.
What I have Tried
I tried to use noindent and setlength{parindent}{0em} in many different combinations.
Minimal Working Example
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
Output

luatex indentation
add a comment |
Problem Description
I am quite a newbie at *TeX, but I defined some newcommands as some kind of paragraph styles (maybe not the proper way to do so, maybe someone could tell me how to accomplish this better).
I want to have default paragraph style with no indentation, space after paragraph should be 0.08", space before paragraph should be 0". However, any of the paragraph style could change any of these settings and some something more (like character styles, e.g. bold, italics, underline, etc).
Now, sometimes I want to insert a paragraph in particular paragraph style without space after that paragraph. For that I use line break (\), which usually does the job. However, with the paragraphStyle below, this is broken.
It seems like if in the first paragraph, there is an indentation of a size of a space, which I cannot elimininate, no matter what I do.
What I have Tried
I tried to use noindent and setlength{parindent}{0em} in many different combinations.
Minimal Working Example
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
Output

luatex indentation
this is really a very strange definition you are setting parindent and parskip hidden insidepargraphStylebut they are not in any local group so they apply to the rest of the document not just the text in the argument. I would seriously consider not using this markup and using a more normal latex constrict.
– David Carlisle
14 mins ago
add a comment |
Problem Description
I am quite a newbie at *TeX, but I defined some newcommands as some kind of paragraph styles (maybe not the proper way to do so, maybe someone could tell me how to accomplish this better).
I want to have default paragraph style with no indentation, space after paragraph should be 0.08", space before paragraph should be 0". However, any of the paragraph style could change any of these settings and some something more (like character styles, e.g. bold, italics, underline, etc).
Now, sometimes I want to insert a paragraph in particular paragraph style without space after that paragraph. For that I use line break (\), which usually does the job. However, with the paragraphStyle below, this is broken.
It seems like if in the first paragraph, there is an indentation of a size of a space, which I cannot elimininate, no matter what I do.
What I have Tried
I tried to use noindent and setlength{parindent}{0em} in many different combinations.
Minimal Working Example
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
Output

luatex indentation
Problem Description
I am quite a newbie at *TeX, but I defined some newcommands as some kind of paragraph styles (maybe not the proper way to do so, maybe someone could tell me how to accomplish this better).
I want to have default paragraph style with no indentation, space after paragraph should be 0.08", space before paragraph should be 0". However, any of the paragraph style could change any of these settings and some something more (like character styles, e.g. bold, italics, underline, etc).
Now, sometimes I want to insert a paragraph in particular paragraph style without space after that paragraph. For that I use line break (\), which usually does the job. However, with the paragraphStyle below, this is broken.
It seems like if in the first paragraph, there is an indentation of a size of a space, which I cannot elimininate, no matter what I do.
What I have Tried
I tried to use noindent and setlength{parindent}{0em} in many different combinations.
Minimal Working Example
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
Output

luatex indentation
luatex indentation
edited 29 mins ago
Sebastiano
11.4k42366
11.4k42366
asked 37 mins ago
tukusejssirstukusejssirs
878
878
this is really a very strange definition you are setting parindent and parskip hidden insidepargraphStylebut they are not in any local group so they apply to the rest of the document not just the text in the argument. I would seriously consider not using this markup and using a more normal latex constrict.
– David Carlisle
14 mins ago
add a comment |
this is really a very strange definition you are setting parindent and parskip hidden insidepargraphStylebut they are not in any local group so they apply to the rest of the document not just the text in the argument. I would seriously consider not using this markup and using a more normal latex constrict.
– David Carlisle
14 mins ago
this is really a very strange definition you are setting parindent and parskip hidden inside
pargraphStyle but they are not in any local group so they apply to the rest of the document not just the text in the argument. I would seriously consider not using this markup and using a more normal latex constrict.– David Carlisle
14 mins ago
this is really a very strange definition you are setting parindent and parskip hidden inside
pargraphStyle but they are not in any local group so they apply to the rest of the document not just the text in the argument. I would seriously consider not using this markup and using a more normal latex constrict.– David Carlisle
14 mins ago
add a comment |
2 Answers
2
active
oldest
votes
As Marcel pointed out, there is a stray space in your input. You can remove that space, as Marcel suggests, or you can add ignorespaces, within your macro definition, to your argument of textbf, prior to #1. Also, there is no need for the textbf{} to be in its own braces, so I removed it.
Note: an alternative for that part of the definition that now reads textbf{ignorespaces#1} could also be {bfseries#1}. Here, the braces are now necessary to limit the scope, but the ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseries.
Also, I reorganized your definition of paragraphStyle to make it easier for humans to read. Note the presence of % end-of-line delimiters, to avoid the very same problem again.
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
%usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
%setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{%
setlength{parindent}{0pt}%
setlength{parskip}{0.16in}%
renewcommand{baselinestretch}{2.0}%
color{black!100}%
fontsize{20pt}{24pt}%
selectfont%
textbf{ignorespaces#1}%
color{black!100}%
normalsize%
setlength{parindent}{0em}%
setlength{parskip}{0.08in}%
selectfont%
renewcommand{baselinestretch}{1.0}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is no longer wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}

ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseriesno:-)
– David Carlisle
14 mins ago
@DavidCarlisle Why do you say that?bfseries<space><space><space><etc> #1also produces no introduced spaces. What's the right terminology to describe this process?
– Steven B. Segletes
2 mins ago
ignorespaceswas there to ignore spaces that are passed in at the start of#1they would not be dropped in the way that a literal space afterbfseriesis dropped.
– David Carlisle
38 secs ago
add a comment |
The "indentation of a size of a space" actually isn't an indentation, it is a space at the start of the line:
Look at
This is wrong:
paragraphStyle{
First line\
Second line
}
The newline after paragraphStyle{ is converted to a space which results in the observed "indentation".
You can avoid this by adding a % to comment the newline, suppressing the space:
This is wrong:
paragraphStyle{%
First line\
Second line
}
The full document becomes
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{%
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f487436%2fwith-indentation-set-to-0em-when-using-a-line-break-there-is-still-an-indent%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As Marcel pointed out, there is a stray space in your input. You can remove that space, as Marcel suggests, or you can add ignorespaces, within your macro definition, to your argument of textbf, prior to #1. Also, there is no need for the textbf{} to be in its own braces, so I removed it.
Note: an alternative for that part of the definition that now reads textbf{ignorespaces#1} could also be {bfseries#1}. Here, the braces are now necessary to limit the scope, but the ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseries.
Also, I reorganized your definition of paragraphStyle to make it easier for humans to read. Note the presence of % end-of-line delimiters, to avoid the very same problem again.
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
%usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
%setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{%
setlength{parindent}{0pt}%
setlength{parskip}{0.16in}%
renewcommand{baselinestretch}{2.0}%
color{black!100}%
fontsize{20pt}{24pt}%
selectfont%
textbf{ignorespaces#1}%
color{black!100}%
normalsize%
setlength{parindent}{0em}%
setlength{parskip}{0.08in}%
selectfont%
renewcommand{baselinestretch}{1.0}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is no longer wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}

ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseriesno:-)
– David Carlisle
14 mins ago
@DavidCarlisle Why do you say that?bfseries<space><space><space><etc> #1also produces no introduced spaces. What's the right terminology to describe this process?
– Steven B. Segletes
2 mins ago
ignorespaceswas there to ignore spaces that are passed in at the start of#1they would not be dropped in the way that a literal space afterbfseriesis dropped.
– David Carlisle
38 secs ago
add a comment |
As Marcel pointed out, there is a stray space in your input. You can remove that space, as Marcel suggests, or you can add ignorespaces, within your macro definition, to your argument of textbf, prior to #1. Also, there is no need for the textbf{} to be in its own braces, so I removed it.
Note: an alternative for that part of the definition that now reads textbf{ignorespaces#1} could also be {bfseries#1}. Here, the braces are now necessary to limit the scope, but the ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseries.
Also, I reorganized your definition of paragraphStyle to make it easier for humans to read. Note the presence of % end-of-line delimiters, to avoid the very same problem again.
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
%usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
%setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{%
setlength{parindent}{0pt}%
setlength{parskip}{0.16in}%
renewcommand{baselinestretch}{2.0}%
color{black!100}%
fontsize{20pt}{24pt}%
selectfont%
textbf{ignorespaces#1}%
color{black!100}%
normalsize%
setlength{parindent}{0em}%
setlength{parskip}{0.08in}%
selectfont%
renewcommand{baselinestretch}{1.0}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is no longer wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}

ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseriesno:-)
– David Carlisle
14 mins ago
@DavidCarlisle Why do you say that?bfseries<space><space><space><etc> #1also produces no introduced spaces. What's the right terminology to describe this process?
– Steven B. Segletes
2 mins ago
ignorespaceswas there to ignore spaces that are passed in at the start of#1they would not be dropped in the way that a literal space afterbfseriesis dropped.
– David Carlisle
38 secs ago
add a comment |
As Marcel pointed out, there is a stray space in your input. You can remove that space, as Marcel suggests, or you can add ignorespaces, within your macro definition, to your argument of textbf, prior to #1. Also, there is no need for the textbf{} to be in its own braces, so I removed it.
Note: an alternative for that part of the definition that now reads textbf{ignorespaces#1} could also be {bfseries#1}. Here, the braces are now necessary to limit the scope, but the ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseries.
Also, I reorganized your definition of paragraphStyle to make it easier for humans to read. Note the presence of % end-of-line delimiters, to avoid the very same problem again.
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
%usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
%setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{%
setlength{parindent}{0pt}%
setlength{parskip}{0.16in}%
renewcommand{baselinestretch}{2.0}%
color{black!100}%
fontsize{20pt}{24pt}%
selectfont%
textbf{ignorespaces#1}%
color{black!100}%
normalsize%
setlength{parindent}{0em}%
setlength{parskip}{0.08in}%
selectfont%
renewcommand{baselinestretch}{1.0}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is no longer wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}

As Marcel pointed out, there is a stray space in your input. You can remove that space, as Marcel suggests, or you can add ignorespaces, within your macro definition, to your argument of textbf, prior to #1. Also, there is no need for the textbf{} to be in its own braces, so I removed it.
Note: an alternative for that part of the definition that now reads textbf{ignorespaces#1} could also be {bfseries#1}. Here, the braces are now necessary to limit the scope, but the ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseries.
Also, I reorganized your definition of paragraphStyle to make it easier for humans to read. Note the presence of % end-of-line delimiters, to avoid the very same problem again.
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
%usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
%setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{%
setlength{parindent}{0pt}%
setlength{parskip}{0.16in}%
renewcommand{baselinestretch}{2.0}%
color{black!100}%
fontsize{20pt}{24pt}%
selectfont%
textbf{ignorespaces#1}%
color{black!100}%
normalsize%
setlength{parindent}{0em}%
setlength{parskip}{0.08in}%
selectfont%
renewcommand{baselinestretch}{1.0}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is no longer wrong:
paragraphStyle{
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}

edited 19 mins ago
answered 31 mins ago
Steven B. SegletesSteven B. Segletes
163k9207420
163k9207420
ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseriesno:-)
– David Carlisle
14 mins ago
@DavidCarlisle Why do you say that?bfseries<space><space><space><etc> #1also produces no introduced spaces. What's the right terminology to describe this process?
– Steven B. Segletes
2 mins ago
ignorespaceswas there to ignore spaces that are passed in at the start of#1they would not be dropped in the way that a literal space afterbfseriesis dropped.
– David Carlisle
38 secs ago
add a comment |
ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseriesno:-)
– David Carlisle
14 mins ago
@DavidCarlisle Why do you say that?bfseries<space><space><space><etc> #1also produces no introduced spaces. What's the right terminology to describe this process?
– Steven B. Segletes
2 mins ago
ignorespaceswas there to ignore spaces that are passed in at the start of#1they would not be dropped in the way that a literal space afterbfseriesis dropped.
– David Carlisle
38 secs ago
ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseries no:-)– David Carlisle
14 mins ago
ignorespaces is no longer required, because the space is absorbed in the aftermath of the macro bfseries no:-)– David Carlisle
14 mins ago
@DavidCarlisle Why do you say that?
bfseries<space><space><space><etc> #1 also produces no introduced spaces. What's the right terminology to describe this process?– Steven B. Segletes
2 mins ago
@DavidCarlisle Why do you say that?
bfseries<space><space><space><etc> #1 also produces no introduced spaces. What's the right terminology to describe this process?– Steven B. Segletes
2 mins ago
ignorespaces was there to ignore spaces that are passed in at the start of #1 they would not be dropped in the way that a literal space after bfseries is dropped.– David Carlisle
38 secs ago
ignorespaces was there to ignore spaces that are passed in at the start of #1 they would not be dropped in the way that a literal space after bfseries is dropped.– David Carlisle
38 secs ago
add a comment |
The "indentation of a size of a space" actually isn't an indentation, it is a space at the start of the line:
Look at
This is wrong:
paragraphStyle{
First line\
Second line
}
The newline after paragraphStyle{ is converted to a space which results in the observed "indentation".
You can avoid this by adding a % to comment the newline, suppressing the space:
This is wrong:
paragraphStyle{%
First line\
Second line
}
The full document becomes
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{%
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
add a comment |
The "indentation of a size of a space" actually isn't an indentation, it is a space at the start of the line:
Look at
This is wrong:
paragraphStyle{
First line\
Second line
}
The newline after paragraphStyle{ is converted to a space which results in the observed "indentation".
You can avoid this by adding a % to comment the newline, suppressing the space:
This is wrong:
paragraphStyle{%
First line\
Second line
}
The full document becomes
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{%
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
add a comment |
The "indentation of a size of a space" actually isn't an indentation, it is a space at the start of the line:
Look at
This is wrong:
paragraphStyle{
First line\
Second line
}
The newline after paragraphStyle{ is converted to a space which results in the observed "indentation".
You can avoid this by adding a % to comment the newline, suppressing the space:
This is wrong:
paragraphStyle{%
First line\
Second line
}
The full document becomes
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{%
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
The "indentation of a size of a space" actually isn't an indentation, it is a space at the start of the line:
Look at
This is wrong:
paragraphStyle{
First line\
Second line
}
The newline after paragraphStyle{ is converted to a space which results in the observed "indentation".
You can avoid this by adding a % to comment the newline, suppressing the space:
This is wrong:
paragraphStyle{%
First line\
Second line
}
The full document becomes
%%%%% Preamble %%%%%
documentclass[10pt]{book}
usepackage[a4paper]{geometry}
geometry{
a4paper,
left=1in,
right=1in,
top=1in,
bottom=1in,
portrait
}
usepackage{xcolor}
% Font family
usepackage[math-style=ISO, bold-style=ISO, partial=upright, nabla=upright]{unicode-math}
setmainfont{Libertinus Serif}
% Paragraph and line settings
setlength{parindent}{0em} % Set paragraph indentation
setlength{parskip}{0.08in} % Paragraph spacing
renewcommand{baselinestretch}{1.0} % Line expandafterselectlanguageexpandafter{cvlang}
% Custom commands
newcommand{paragraphStyle}[1]{setlength{parindent}{0pt}setlength{parskip}{0.16in}renewcommand{baselinestretch}{2.0}color{black!100}fontsize{20pt}{24pt}selectfont{textbf{#1}}color{black!100}normalsizesetlength{parindent}{0em}setlength{parskip}{0.08in}selectfontrenewcommand{baselinestretch}{1.0}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
pagestyle{empty}
This is wrong:
paragraphStyle{%
First line\
Second line
}
This is correct:
paragraphStyle{First line}\
paragraphStyle{Second line}
Also this is correct in indentation, but not in space after paragraph:
First Line\
Second Line
end{document}
answered 32 mins ago
Marcel KrügerMarcel Krüger
13k11636
13k11636
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f487436%2fwith-indentation-set-to-0em-when-using-a-line-break-there-is-still-an-indent%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
this is really a very strange definition you are setting parindent and parskip hidden inside
pargraphStylebut they are not in any local group so they apply to the rest of the document not just the text in the argument. I would seriously consider not using this markup and using a more normal latex constrict.– David Carlisle
14 mins ago