TeX - LaTeX Asked by James Chung on November 21, 2020
I am looking for a way to add an indentation after setting parindent
to 0. I tried a suitable amount of search, but none really seemed to meet my needs.
I tried to change the command indent
by inserting spaces:
renewcommand{indent}{hspace{15pt}}
However, indent
did not add any extra space at the start of a new paragraph.
Can anyone please help me?
You should always be able to use hspace
for this purpose: hspace{5mm}
EDIT:
In order for hspace
to work you probably have to switch from vertical to horizontal mode using leavevmode
. See Function and usage of leavevmode and What are vertical and horizontal modes?
So all in all this should work: leavevmodehspace{5mm}
Answered by Raven on November 21, 2020
First store the original indent by adding
newlength{saveparindent}
AtBeginDocument{setlength}{saveparindent}{parindent}}
to your preamble. Then also add
newcommand{indentpar}{parhspace*{saveparindent}ignorespaces}
as your new indentation mechanism.
Assuming you have setlength{parindent}{0pt}
somewhere else in your document you should now be able to use it in the following way:
documentclass{article}
newlength{saveparindent}
AtBeginDocument{setlength{saveparindent}{parindent}}
newcommand{indentpar}{parhspace*{saveparindent}ignorespaces}
begin{document}
This is an indented paragraph.
setlength{parindent}{0pt}% Remove paragraph indentation
This is a paragraph that is not indented.
indentpar
Here is a new indented paragraph.
end{document}
Of course, LaTeX also provides noindent
, if you're only interested in some non-indented paragraphs:
documentclass{article}
begin{document}
This is an indented paragraph.
noindent% Remove paragraph indentation just for this paragraph
This is a paragraph that is not indented.
Here is a new indented paragraph.
end{document}
Answered by Werner on November 21, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP