Problem Description
I am quite a newbie at *TeX, but I defined some \newcommand
s 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 \expandafter\selectlanguage\expandafter{\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}\normalsize\setlength{\parindent}{0em}\setlength{\parskip}{0.08in}\selectfont\renewcommand{\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}
\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.