![すべての段落に横方向の余白を設定し、他の要素には設定しないようにするにはどうすればよいですか?](https://rvso.com/image/254717/%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E6%AE%B5%E8%90%BD%E3%81%AB%E6%A8%AA%E6%96%B9%E5%90%91%E3%81%AE%E4%BD%99%E7%99%BD%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%97%E3%80%81%E4%BB%96%E3%81%AE%E8%A6%81%E7%B4%A0%E3%81%AB%E3%81%AF%E8%A8%AD%E5%AE%9A%E3%81%97%E3%81%AA%E3%81%84%E3%82%88%E3%81%86%E3%81%AB%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
セクションのタイトル、図、表はすべて幅広にして、段落はすべて幅狭にするために、幅広のページ内に幅狭の段落を表示したいと考えています。
\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}