如何阻止套件 \usepackage{parskip} 禁用段落縮排?

如何阻止套件 \usepackage{parskip} 禁用段落縮排?

我想在段落之間自動插入垂直空間。目前我\medskip在所有段落之前使用。例子:

% proposal.tex
% Based on http://www.latextemplates.com/template/simple-sectioned-essay
\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper, margin=2cm]{geometry}
\usepackage[brazil]{babel}

\usepackage[utf8]{inputenc}
\usepackage{mathptmx}

\usepackage{indentfirst}

\begin{document}

\section{Introdução}

    In typesetting advertisement copy, a way of justifying paragraphs has
    become popular in recent years that is somewhere between flushright
    and raggedrightdddd setting. Lines that would stretch beyond certain limits
    are set with their glue at natural width. This single paragraph is but an
    example of this procedure; the macros are given next.

    \medskip
    Second paragraph.

\end{document}

生成:

在此輸入影像描述

搜尋後我發現包含該包\usepackage{parskip}。然而,在我這樣做之後,我所有的段落縮排都被禁用。

在此輸入影像描述

所以再次搜尋我發現我可以用來\setlength{\parindent}{30pt}重置段落縮進,但是我不確定這是一件好事。

% proposal.tex
% Based on http://www.latextemplates.com/template/simple-sectioned-essay
\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper, margin=2cm]{geometry}
\usepackage[brazil]{babel}

\usepackage[utf8]{inputenc}
\usepackage{mathptmx}

\usepackage{indentfirst}

\usepackage{parskip}
\setlength{\parindent}{30pt}

\begin{document}

\section{Introdução}

    In typesetting advertisement copy, a way of justifying paragraphs has
    become popular in recent years that is somewhere between flushright
    and raggedrightdddd setting. Lines that would stretch beyond certain limits
    are set with their glue at natural width. This single paragraph is but an
    example of this procedure; the macros are given next.

    Second paragraph.

\end{document}

生成:

在此輸入影像描述

我想知道是否有最好的方法可以包含該包\usepackage{parskip}並保留預設的 LaTeX 段落縮進,而不是用\setlength{\parindent}{30pt}.

答案1

parskip包包含一行\parindent=\z@\parindent.因此,可以\parindent在載入parskip套件之前保存目前值,然後恢復 的值\parindent

\parindent順便說一句,用你的設置覆蓋30pt是一種完全有效的編碼形式,儘管有些人從風格的角度認為 和 中至少有一個\parskip應該\parindent恰好是 0pt,但你不會從我這裡得到任何爭論。

\documentclass{article}
\usepackage{lipsum}
\edef\svtheparindent{\the\parindent}
\usepackage{parskip}
\parindent=\svtheparindent\relax
\begin{document}
\lipsum[1-6]
\end{document}

在此輸入影像描述

相關內容