모든 단락에 측면 여백을 설정하고 다른 요소에는 설정하지 않으려면 어떻게 해야 합니까?

모든 단락에 측면 여백을 설정하고 다른 요소에는 설정하지 않으려면 어떻게 해야 합니까?

넓은 페이지 안에 좁은 문단을 얻어서 절 제목, 그림, 표 등이 모두 넓어지고 문단이 모두 좁아지도록 하고 싶습니다.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\setlength{\parindent}{0pt} % so we can see better what is happening

\newenvironment{narrowpar}% I’d like every paragraph to follow these rules.
{\begin{list}{}{%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\leftmargin}{2cm}%
\setlength{\rightmargin}{2cm}%
}\item }%
{\end{list}}

\begin{document}    

\section{A section title that ranges across the page}

This is a paragraph (Loret Ipsum So On). And below, an equation that can make use of the whole page width:

\begin{equation}
p v = R T
\end{equation}

Here is another paragraph.

\begin{narrowpar}
This very text looks exactly the way I would like my paragraphs to look. But unfortunately it forces me to insert code manually before and after every paragraph in the source file.
\end{narrowpar}

\end{document}

내가 얻고 싶은 것

다른 방식으로 말하면 페이지 여백을 사용하지 않고 모든 단락에 대해 측면 공간(HTML/CSS에서 "왼쪽 및 오른쪽 여백")을 제어하려고 합니다. 어떤 도움이라도 주시면 감사하겠습니다...

답변1

다음 명령을 사용하여 단락 모양을 재정의할 수 있습니다 \parshape.

\parshape 1 .15\hsize.65\hsize

인수 1: 첫 번째 줄, 인수 쌍: .15\hsize.65\hsize왼쪽 및 오른쪽 여백. 다른 모든 줄은 첫 번째 줄로 들여쓰기됩니다.

명령이 있는 단락에만 작동합니다. 따라서 \parshape를 재정의하려면 다음을 포함해야 합니다 \par.

\def\par{\ifhmode\ownpar\fi\endgraf}
\def\ownpar{\parshape 1 .15\hsize.65\hsize}

관련 정보