以剧本方式写台词的环境?

以剧本方式写台词的环境?

假设一个人正在撰写一份科学文献,并且在某个时候有兴趣写几行,例如

  • 玩家:嗨!你好吗?
  • NPC:很好,谢谢!

以剧本的方式。有没有什么好的方法/环境可以实现这一点?

答案1

也许tcolorbox可以给你一个起点......

在此处输入图片描述

代码

\documentclass{article}

\usepackage{tcolorbox}

\usepackage{lipsum} % just for the example

\begin{document}

\section{A section}

\lipsum[1-3]

\section{Fancy section}

\begin{tcolorbox}[colback=yellow!50]
\textbf{Player}: Hi! How are you?
\end{tcolorbox}
\begin{tcolorbox}[colback=green!50]
\textbf{NPC}: Nice, thanks!
\end{tcolorbox}

\end{document} 

您还可以在tcolorbox环境中选择一些奇特的字体,以获得类似的效果

在此处输入图片描述

代码

\documentclass{article}

\usepackage{tcolorbox}

\usepackage{lipsum} % just for the example

\begin{document}

\section{A section}

\lipsum[1-3]

\section{Fancy section}

\begin{tcolorbox}[colback=yellow!50]
\textbf{Player}: \fontfamily{pzc}\selectfont Hi! How are you?
\end{tcolorbox}
\begin{tcolorbox}[colback=green!50]
\textbf{NPC}: \fontfamily{pzc}\selectfont Nice, thanks!
\end{tcolorbox}

\end{document} 

答案2

由于问题如此开放,这是我的建议,使用以下bclogo包: 平均能量损失

\documentclass[twocolumn]{article}
\usepackage{microtype}  
\usepackage{lipsum}  % dummy text
\usepackage[tikz]{bclogo}

\newcommand\FancyBox[2]{%
\begin{bclogo}[couleur=yellow!15!orange!05,
logo=\Huge\bcplume, arrondi=0.3, ombre=true,
couleurOmbre=gray, 
couleurBarre=orange!30,
couleurBord=orange!30!gray!60,
marge=12, blur]%
{\hfill#1\hfill}%title
\bigskip
\begin{description}
#2
\end{description}
\end{bclogo}
}%

\begin{document}

\section{Introduction}
\lipsum[1]

\FancyBox{The salutation}
{\item[Player:] Hi! How are you?
\item[NPC:] Nice, thanks!}

\lipsum[3]

\FancyBox{The discussion}
{\item[Player:] \lipsum[2]
\item[NPC:] \lipsum[2]}

\lipsum[4]

\end{document}

答案3

没有任何花哨的东西,并且tabular

\documentclass{article}

\usepackage{array}
\newcolumntype{R}{p{\dimexpr0.88\textwidth-2\tabcolsep\relax}}
\newcolumntype{L}{p{0.12\textwidth}}

\newenvironment{play}[1][Player]{%
\noindent\tabular{@{}L>{\raggedright\arraybackslash}R@{}}
\textbf{#1:} &%
}%
{\endtabular}%

\begin{document}

\section{A section}

\begin{play}[Player]
 Hi! How are you?
\end{play}
\begin{play}[NPC]
Nice, thanks!
\end{play}

\end{document}

在此处输入图片描述

让我们添加颜色:

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{array}
\newcolumntype{R}{p{\dimexpr0.88\textwidth-2\tabcolsep\relax}}
\newcolumntype{L}{p{0.12\textwidth}}

\usepackage{xparse}

\NewDocumentEnvironment{play}{O{Player}O{blue}}{%
\noindent\tabular{@{}L>{\raggedright\arraybackslash}R@{}}
\rowcolor{#2!40}\textbf{#1:} &%
}%
{\endtabular}%

%%syntax
%%\begin{play}[<who talks>][<color>]        %%% default talker is Player and color is blue
%%   <conversation>
%%\end{play}

\begin{document}

\section{A section}

\begin{play}
 Hi! How are you? This line will go over two lines and come to the second line as usual
\end{play}
\begin{play}[NPC][yellow]
Nice, thanks!
\end{play}
\begin{play}[ABC][green]
Nice, thanks!
\end{play}

\end{document}

在此处输入图片描述

相关内容