
セクションのタイトル、図、表はすべて幅広にして、段落はすべて幅狭にするために、幅広のページ内に幅狭の段落を表示したいと考えています。
\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}