两列内容彼此相对定位

两列内容彼此相对定位

在戏剧(和电影)中,演员们倾向于让对方说完话,甚至可能在轮到自己说话之前稍作停顿。但这并不是现实生活中的对话方式,它会导致一种特别僵硬的“戏剧语调”。

为了解决这个问题,我让演员们同时练习说话(这是故意的,也就是说,在现实生活中他们一直都在这样做)。为了帮助他们了解结果应该是什么样的,我希望以可视化的格式向他们提供他们的文本。

我根据我的需要制作了一个文本/纯文本示例:

ALICE: I‘m saying something in
this mock drama of ours, it is      BOB: Yes.
supposed to be a little             CHARLES: No doubt.
monologue of medium length. I‘m
still supposed to be talking,       BOB: I can see that.
because our author needs an
example for you trying to
interrupt me. But, while I‘m
certainly perceiving what you‘re
saying, I‘m not yet letting you
take what linguists call your       BOB: I want to ...
„turn“, for I really want to
finish my thought.                  BOB: I want to say something right
                                    now. I have to admit, I don‘t really
CHARLES: I feel that, too ...       have something to say. But I would
                                    feel left out, if I did not get my
ALICE: Of course.                   turn. I would feel that I‘d be
                                    vanishing in this piece, if I
                                    wouldn‘t say something. I feel that
                                    my sole purpose is to have a little
CHARLES: That‘s ...                 speech right here. And although I
                                    rather feel compelled to talk right
CHARLES: That‘s great, because      now, I also derive some strange kind
it expresses exactly my             of joy from it.
sentiments also. You‘re really
giving voice to ...                 ALICE: Of course, Bob, and now we
                                    all had our turn, except Charles, 
                                    whom I‘m interrupting right now, but
                                    that is intentional. And now we
                                    can finish this little farce,
                                    right? I mean, like: Stop it
                                    right now!

因此,基本上,我需要两列。每列的内容需要相对于另一列中的文本进行定位。在示例中,当 Bob 在右列中说“是的”时,这应该与左列中 Alice 的演讲中的“戏剧”一词发生在同一行。反之亦然:当 Charles 在左列中说“我也觉得……”时,这应该发生在右列中 Bob 说“我真的没有”之后。

我想,只要它是可行的,在 LaTeX 中实现它就相当不容易。基本上,我现在需要一个解决方案,但对于未来的项目来说,也可能是一个更彻底的解决方案。我有一种挥之不去的怀疑,就目前而言,我最好使用 Inkscape 或 Scribus。我希望我错了。对于未来,我想用 LaTeX 或 TeX 找到一个解决方案。我对 LaTeX 黑客攻击几乎没有经验,但我相信,只要有足够的时间,我就能涉足其中。关于在哪里查找的指针和关于如何实现它的一般逻辑的提示可以极大地促进它。另外,我是 org-mode 用户,对 Emacs-Lisp 黑客攻击感到很熟悉。因此,一种可能性是编写一个 emacs 界面并以编程方式生成 TeX 代码。

例如,可能的 LaTeX 界面可以包含一个命令\turn{LABEL},用于指示另一列中新回合的开始,并\turnlabel{LABEL}指示相对于前一个回合,新回合的垂直位置。该界面可以再次包含一个命令,\interruption用于不构成回合的中断。例如:

%% mock LaTeX

\turn{Alice} 

ALICE: I‘m saying something in this mock drama
\interruption{BOB: Yes.} \interruption{CHARLES: No doubt.}
of ours, it is supposed to be a little monologue of medium
length. I‘m still supposed to be talking \interruption{BOB:
  I can see that.}, because our author needs an example for
you trying to interrupt me. But, while I‘m certainly
perceiving what you‘re saying, I‘m not yet letting you take
what linguists \interruption{BOB: I want to ...} call your
„turn“, for I really want to finish \turnlabel{Bob} my
thought.

\turn{Bob}
BOB: I want to say something right now. [...]

答案1

在此处输入图片描述

对于分页符附近的多行中断或太近的中断,这不是太智能。

注释掉之后你会看到一些代码,这些代码.pos在运行结束时记录了文件中的垂直开始和结束位置,这可以在以后的传递中用于自动移动事物,但这会变得棘手和不稳定,并且可能对于一个游戏你最终还是想要手动控制,所以这使用了一个更简单的方案,\turn\interruption采用可选的第一个参数,然后将文本移动该基线跳过的数量。

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\makeatletter

\setlength\columnsep{20pt}

\newwrite\iterpos

%\immediate\openout\iterpos=\jobname.pos

\raggedbottom
\parskip\z@

\newcount\turncnt
\newcount\intercnt

\def\dialog{%
\par
\global\turncnt\z@
\linewidth=\dimexpr(\textwidth-\columnsep)/2\relax
\hsize\linewidth}

\def\enddialog{\par}


\newcommand\turn[2][0]{%
\global\advance\turncnt\@ne
\setbox0\hbox{\textbf{#2: }}%
\everypar{\setbox2\lastbox\box0\everypar{}}
\par
\ifnum#1=\z@\else\vskip#1\baselineskip\fi
\ifodd\turncnt
\hsize\linewidth
\leftskip\z@
\else
\hsize\dimexpr2\linewidth+\columnsep\relax
\leftskip\dimexpr\linewidth+\columnsep\relax
\fi
\ignorespaces}

\newcommand\interruption[3][0]{%
\global\advance\intercnt\@ne
\@bsphack
\strut\vadjust{\noindent
\ifodd\turncnt
\hspace*{\dimexpr\linewidth+\columnsep\relax}%
\else
\hspace*{\dimexpr-\linewidth-\columnsep\relax}%
\fi
\raisebox{\dimexpr\dp\strutbox
\ifnum#1=\z@\else-(#1\baselineskip)\fi
\relax}[\z@][\z@]{\parbox[t]{\linewidth}{%
%\pdfsavepos
%\edef\tmp{\write\iterpos{\string\def\string\intterstart\romannumeral\intercnt{\noexpand\the\pdflastypos}}}\tmp
\textbf{#2: }#3%
  \ifhmode\unskip\fi
%\pdfsavepos
%\edef\tmp{\write\iterpos{\string\def\string\intterend\romannumeral\intercnt{\noexpand\the\pdflastypos}}}\tmp
}}}%
\@esphack}

\makeatother


\begin{document}
\begin{dialog}
\turn{ALICE}I‘m saying something in
this mock drama
\interruption{BOB}{Yes.} \interruption[1]{CHARLES}{No doubt.}
 of ours, it is supposed to be a little            
monologue of medium length. I‘m
still supposed to be talking\interruption{BOB}{I can see that.},     
because our author needs an
example for you trying to
interrupt me. But, while I‘m
certainly perceiving what you‘re
saying, I‘m not yet letting you
take what linguists\interruption{BOB}{I want to ...} call your       
„turn“, for I really want to
finish my thought.                  \turn[-2]{BOB}

                                    I want to say something right
                                    now. I have to admit, I don‘t really
                                   have something to say.\interruption{CHARLES}{ feel that, too ...} But I would
                                    feel left out, if I did not get my
                  turn.\interruption{ALICE}{Of course.} I would feel that I‘d be
                                    vanishing in this piece, if I
                                    wouldn‘t say something. I feel that
                                    my sole purpose is to have a little
                 speech right here.\interruption{CHARLES}{That‘s ...} And although I
                                    rather feel compelled to talk right
                                    now, I also derive some strange kind
                                    of joy from it.
\turn[-2]{CHARLES}
That‘s great, because     
it expresses exactly my             
sentiments also. You‘re really
giving voice to ...               \turn{ALICE}

                                    Of course, Bob, and now we
                                    all had our turn, except Charles, 
                                    whom I‘m interrupting right now, but
                                    that is intentional. And now we
                                    can finish this little farce,
                                    right? I mean, like: Stop it
                                    right now!

\end{dialog}
\end{document}

相关内容