以新环境为中心

以新环境为中心

我正在开发一个用于编写脚本的 LaTex 类。在声明对话环境。

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{exampleclass}[2014/08/16 Example LaTeX class]

\newcommand{\headlinecolor}{\normalcolor}
\LoadClass[twocolumn]{article}
\documentclass{article}
\usepackage{amsmath}
\RequirePackage{xcolor}
\definecolor{slcolor}{HTML}{882B21}
 % needed for its \numberwithin command
\newcounter{panelctr}

\renewenvironment{boxed}[1]
{\begin{center}
        #1\\[1ex]
        \begin{tabular}{|p{0.9\textwidth}|}
            \hline\\
        }
        { 
            \\\\\hline
        \end{tabular} 
    \end{center}
}

\newenvironment{panel}{%      define a custom environment
    \bigskip\noindent%         create a vertical offset to previous material
    \refstepcounter{panelctr}% increment the environment's counter
    \textsc{Panel \thepanelctr}% or \textbf, \textit, ...
    \newline%
}{\par\bigskip}  %          create a vertical offset to following material
\numberwithin{panelctr}{section}

\newenvironment{character}[1]
{%
    \vfill
    \hfill
    \textbf{#1}\\
        } 
        {

    \hfill
    \vfill
}%
%--------------------------------------------------


\begin{document}
Below this line a boxed environment is used

\begin{boxed}{Title of the Box}
    This is the text formatted by the boxed environment
\end{boxed}

This text is again outside the environment

\section{First section}

Some text before the first algorithm environment \ldots

\begin{panel}
    Some thoughts
    \begin{character}{Character1}
        Hello, This text is again outside the environment
    \end{character}

    \begin{character}{Character2}
        test dialog
    \end{character}
\end{panel}

\begin{panel}
    More thoughts
\end{panel}

\end{document}

目前实际的对话框似乎没有居中,而角色名称居中。我的想法格式: 在此处输入图片描述

如果有办法让括号与对话框的中心左对齐或右对齐,那就太好了

答案1

只需使用screenplay文档类即可。还有更多适用于此的包和类,请参阅https://www.ctan.org/topic/drama-script

\documentclass{screenplay}
\begin{document}

\begin{dialogue}[looking up]{Joe}
  And the position of the character's name?
\end{dialogue}
\begin{dialogue}{April}
  ALL CAPS, and tabbed to about 4.0 to 4.2 inches, depending upon the
  look you like. Some writers center al characters' name in
  dialogue. Personally, I don't think it matters too much.
\end{dialogue}

\end{document}

在此处输入图片描述

相关内容