Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Assuming that one is writing a scientific document and at some point is interested in writing a couple of lines, ex.

  • Player: Hi! How are you?
  • NPC: Nice, thanks!

in a screenplay fashion. Is there some nice way/environment in order to achieve that?

share|improve this question

3 Answers 3

Probably tcolorbox can give you a start point...

enter image description here

Code

\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} 

You can also choose some fancy font inside the tcolorbox environment to get something like

enter image description here

Code

\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} 
share|improve this answer

Without anything fancy and with 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}

enter image description here

Let us add color:

\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}

enter image description here

share|improve this answer

As the question is so open, this is my suggestion, using the bclogo package: MWE

\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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.