dramatist
我正在使用该包排版戏剧脚本,它定义了drama
环境,基本上就是一个list
环境,每个演讲条目都是一个列表项。由于我需要多次打印脚本,所以我想减少演讲项之间的间距。
环境drama
声明如下:
\newenvironment{drama}{%
\if@lnpa
\PackageWarning{dramatist}{\lnpwarning{a}}
\fi
\if@lnps
\PackageWarning{dramatist}{\lnpwarning{s}}
\fi
\list{}{%
\labelwidth\speakswidth
\itemindent\speaksindent
\itemsep\speechskip
\parsep\Dparsep
\labelsep\Dlabelsep
\let\makelabel\speakslabel}
} {\endlist}
尺寸也声明如下dramatist.sty
:
\newdimen\speakswidth
\speakswidth\z@
\newdimen\speaksindent
\speaksindent=-\leftmargin
\newdimen\speechskip
\speechskip\itemsep
\newdimen\Dparsep
\Dparsep\z@
\newdimen\Dlabelsep
\Dlabelsep\labelsep
它甚至支持读取配置文件:
\InputIfFileExists{dramatist.cfg}{\foundfile}{\inputfilewarning}
我发现项目之间的间距可能是由 -dimension 设置的\speechskip
,因此我尝试创建一个包含以下内容的配置文件:
\speechskip=0em
\speaksindent=0em
该包读取该配置文件,如日志中所述:
Package dramatist Warning: Using Configuration file dramatist.cfg. .
但项目之间的缩进和跳过都没有改变。我不知道为什么配置文件没有被正确读取,因为我认为我所做的尺寸声明是正确的。
MWE 可能看起来像这样:
\documentclass[oneside,12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{scrpage2}
\usepackage[utf8]{inputenc}
\usepackage{dramatist}
\usepackage[x11names]{xcolor}
\usepackage{tcolorbox}
\usepackage[bookmarks]{hyperref}
\begin{document}
\newcommand{\role}[1]{\textcolor{blue}{(\textit{#1})}}
\begin{CharacterGroup}{Andere alte Leute}
\GCharacter{Marta \role{Elisa}}{Marta}{marta}
\end{CharacterGroup}
\newcommand{\martax}[1]{\item\leavevmode\begin{tcolorbox}[title=\marta,colframe=red]#1\end{tcolorbox}}
This is the regular document inset.
\begin{drama}
\martax{I can talk}
This is the list inset.
\martax{I can talk}
\martax{I can talk}
\martax{I can talk}
\end{drama}
\end{document}
任何关于如何缩小物品之间距离的想法都非常感谢!提前致谢 ;)
编辑:Christian Hupfer 的回答修复了语音框之间的间距,我非常感激 ;) 左边的间距怎么样?欢迎提出任何想法 ;)
编辑2:我还尝试直接更改源dramatist.sty
以修复错误的左缩进,但无济于事:(当然仅用于测试目的)
\newenvironment{drama}{%
...
\list{}{%
...
\itemindent0em
...
} {\endlist}
和:
\newenvironment{drama}{%
...
\list{}{%
...
\itemindent=0em
...
} {\endlist}
编辑3:使用 Christian Hupfer 的新解决方案,我能够将左缩进减少到最小。但左侧仍有一点间距,右侧则多一点,虽然不多,但当语音框位于其他未缩进的内容(如彩色 parbox 或某些普通文本(在戏剧环境之外))旁边时,它会变得可见。有没有办法修复这最后一点不必要的间距?
答案1
除非使用该选项,否则包tcolorbox
会将tcolorbox
环境放在段落中nobeforeafter
。保留缩进的更好方法是应用before={\hskip\dimexpr\leftmargin-\speechskip}
并留空after={}
剩余间距为\itemsep
和自然的。比较和\interlineskip
之间的差异\martax
\martay
\documentclass[oneside,12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{scrpage2}
\usepackage[utf8]{inputenc}
\usepackage{dramatist}
\usepackage[x11names]{xcolor}
\usepackage{tcolorbox}
\usepackage[bookmarks]{hyperref}
\begin{document}
\newcommand{\role}[1]{\textcolor{blue}{(\textit{#1})}}
\begin{CharacterGroup}{Andere alte Leute}
\GCharacter{Marta \role{Elisa}}{Marta}{marta}
\end{CharacterGroup}
\newcommand{\martax}[1]{\item\mbox{}\begin{tcolorbox}[before={\hskip\dimexpr\leftmargin-\speechskip},after={},title=\marta,colframe=red]#1\end{tcolorbox}}
\newcommand{\martay}[1]{\item\mbox{}\begin{tcolorbox}[title=\marta,colframe=blue]#1\end{tcolorbox}}
This is the regular document inset.
\begin{drama}
\martax{I can talk}
This is the list inset.
\martax{I can talk}
\martax{I can talk}
\martax{I can talk}
\end{drama}
\begin{drama}
\martay{I can talk}
This is the list inset.
\martay{I can talk}
\martay{I can talk}
\martay{I can talk}
\end{drama}
\end{document}
更新
我改变了文本插入并删除了\mbox{}
导致错误水平间距的命令。
\documentclass[oneside,12pt]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{scrpage2}
\usepackage[utf8]{inputenc}
\usepackage{dramatist}
\usepackage[x11names]{xcolor}
\usepackage{tcolorbox}
\usepackage{xpatch}
\usepackage[bookmarks]{hyperref}
\newlength{\dramatextinset}
\setlength{\dramatextinset}{\dimexpr-\leftmargin+\labelsep}
\xapptocmd{\drama}{%
\setlength{\parindent}{\dramatextinset}%
}{\typeout{Success}}{\typeout{Failure}}
\usepackage{showframe}
\newcommand{\role}[1]{\textcolor{blue}{(\textit{#1})}}
\begin{CharacterGroup}{Andere alte Leute}
\GCharacter{Marta \role{Elisa}}{Marta}{marta}
\end{CharacterGroup}
\newcommand{\martax}[1]{\item\begin{tcolorbox}[before={},after={},title=\marta,colframe=red]#1\end{tcolorbox}}
\newcommand{\martay}[1]{\item\begin{tcolorbox}[title=\marta,colframe=blue]#1\end{tcolorbox}}
\begin{document}
This is the regular document inset.
\begin{drama}
\martax{I can talk}
This is the list inset.
\martax{I can talk}
\martax{I can talk}
\martax{I can talk}
\end{drama}
\begin{drama}
\martay{I can talk}
This is the list inset.
\martay{I can talk}
\martay{I can talk}
\martay{I can talk}
\end{drama}
\end{document}