插入非常宽的段落或图片...

插入非常宽的段落或图片...

关于宽段落的问题和答案相当受欢迎。我希望我的文档中有一种新的“元素”,它允许我显示可以包含文本、图片或表格的宽段落……布局显示在图片上。我自己的解决方案相当简单 - 它有效,但它有两个主要问题:

  • 它会抛出大量溢出的水平盒子
  • 它可以与 marginpar 文本“混合”(将其放在另一个文本之上)

新元素的外观和感觉

-------------
|         | |
|         | |
|         | |
|-----------|
|new element|
|-----------|
|         | |
-------------

%PREAMBLE STUFF
\newlength{\wideparwidth} %The width of our new element
\setlength{\wideparwidth}{\textwidth}        %Initializing to textwidth...
\addtolength{\wideparwidth}{\marginparsep}   %adding marginsep...
\addtolength{\wideparwidth}{\marginparwidth} %adding marginparwidth

\newcommand{\widepar}[1]{\parbox{\wideparwidth}{#1}} %The actual command

%USAGE
\begin{document}
...
\widepar{The text which appears in the very wide paragraph...}
...
\end{document}

有人知道有哪个现有的软件包支持这种布局吗?如果没有,请给我一些提示,告诉我如何防止 marginpar 文本重叠(我认为这并不简单)。最后但并非最不重要的一点是,我如何才能忽略“overfull hbox”(仅适用于此元素)?

答案1

您可以使用tufte-book具有fullwidth环境的类,也可以滚动您自己的调整边距环境。下图来自我使用此类的文档。该类将解决 marginpars 的大多数问题。

在此处输入图片描述

如果您想自己动手,只需添加评论,我就会发布代码。

编辑(发布最少内容)

\documentclass{article} 
\usepackage[utf8]{inputenc} 
\usepackage{lipsum,ifmtarg}
\begin{document}
\lipsum[1]
\makeatletter
\newenvironment{adjustmargins}[2]{%
  \begin{list}{}{%
    \topsep\z@%
    \listparindent\parindent%
    \parsep\parskip%
   \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
   {\setlength{\leftmargin}{#1}}%
   \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
   {\setlength{\rightmargin}{#2}}%
}
\item[]}{\end{list}}

\newenvironment{adjustmargins*}[2]{%
 \begin{list}{}{%
 \topsep\z@%
 \listparindent\parindent%
 \parsep\parskip%
 \checkoddpage
 \ifoddpage % odd numbered page
 \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
 {\setlength{\leftmargin}{#1}}%
 \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
 {\setlength{\rightmargin}{#2}}%
 \else % even numbered page
 \@ifmtarg{#2}{\setlength{\leftmargin}{\z@}}%
 {\setlength{\leftmargin}{#2}}%
 \@ifmtarg{#1}{\setlength{\rightmargin}{\z@}}%
 {\setlength{\rightmargin}{#1}}%
\fi
}
\item[]}{\end{list}}

\makeatother

\begin{adjustmargins}{-.5in}{-1.0in}
\vfill
\rule{17.2cm}{.4pt}

There are no engineers in the hottest parts of hell, because the existence of a 'hottest part' implies a temperature difference, and any marginally competent engineer would immediately use this to run a heat engine and make some other part of hell comfortably cool.  This is obviously impossible.
\end{adjustmargins}

\end{document}

答案2

除了使用\makebox(如评论中所建议的),您还可以使用adjustwidth来自更改页面包裹。

相关内容