对齐角色和对话

对齐角色和对话

早上好。我想将人物放在红线上,将对话放在蓝线上。蓝线上还有场景命令的主题。可以吗?谢谢。

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[italian]{babel}
\usepackage[noheadfoot, margin=2cm, nomarginpar]{geometry}
\usepackage{textcase}
\usepackage[explicit]{titlesec}

\usepackage{nimbusmono}
\renewcommand*\familydefault{\ttdefault}

\newlength{\postspeciskip}
\postspeciskip = 1.5\baselineskip

\newcommand\sce[1]{\newpage{\LARGE\raggedright #1\par\vskip 24pt}}

\newcommand\character[1]{\par\everypar{\hangindent=0.253\linewidth\hangafter=1}\parskip=0.8\baselineskip plus 1pt\makebox[0.253\linewidth][r]{\MakeTextUppercase{#1}\hskip0.1\linewidth}}

\setlength\parindent {0pt}%

\interlinepenalty = 1000\parskip0pt plus \baselineskip

\begin{document}

\raggedright

\def\mark{\character{Mark}}
\def\karm{\character{Karm}}

\sce{Scene 1 Number one}

\mark Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, vestibulum ut,placerat ac, adipiscing vitae, felis. Curabiturdictum gravida mauris.

\karm Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, vestibulum ut,placerat ac, adipiscing vitae, felis. Curabiturdictum gravida mauris.

\end{document} 

在此处输入图片描述

答案1

如果您需要两个部分,则该\sce命令需要两个参数。我只会声明一个固定的\leftskip,而不是使用\hangindent:在边缘设置某些东西比在边缘设置几乎所有远离边缘的东西都更容易。

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[italian]{babel}
\usepackage[noheadfoot, margin=2cm, nomarginpar]{geometry}
\usepackage{textcase}
%\usepackage[explicit]{titlesec}

\usepackage{nimbusmono}
\renewcommand*\familydefault{\ttdefault}

\newlength{\postspeciskip}
\newlength{\standardindent}
\AtBeginDocument{%
  \setlength{\postspeciskip}{1.5\baselineskip}%
  \setlength{\standardindent}{0.253\textwidth}%
  \setlength{\leftskip}{\standardindent}%
}

\newcommand\sce[2]{%
  %\clearpage % commented just for the example
  \setlength{\parskip}{0pt plus \baselineskip}
  {\LARGE\toleft{Scene #1}#2\par}
  \nopagebreak
  \addvspace{24pt}%
}
\newcommand{\toleft}[1]{\makebox[0pt][r]{\makebox[\standardindent][l]{#1}}}

\newcommand\character[1]{%
  \par
  \setlength{\parskip}{0.8\baselineskip plus 1pt}%
  \toleft{\MakeTextUppercase{#1}}%
}

\setlength\parindent{0pt}

\interlinepenalty = 1000
\setlength{\parskip}{0pt plus \baselineskip}
\raggedright

\begin{document}


\newcommand{\Mark}{\character{Mark}}
\newcommand{\Karm}{\character{Karm}}

\sce{1}{Number one}

\Mark Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, 
      vestibulum ut,placerat ac, adipiscing vitae, felis. Curabiturdictum 
      gravida mauris.

      Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, 
      vestibulum ut,placerat ac, adipiscing vitae, felis. Curabiturdictum 
      gravida mauris.

\Karm Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, 
      vestibulum ut,placerat ac, adipiscing vitae, felis. Curabiturdictum 
      gravida mauris.

\sce{1}{Number two}

\Mark Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, 
      vestibulum ut,placerat ac, adipiscing vitae, felis. Curabiturdictum 
      gravida mauris.

\Karm Lorem ipsum dolor sit amet, consectetueradipiscing elit. Ut purus elit, 
      vestibulum ut,placerat ac, adipiscing vitae, felis. Curabiturdictum 
      gravida mauris.

\end{document} 

对于图片,我注释掉了\clearpage以便在同一页面中看到两个场景。

避免\def:如果\def\mark你重新定义了 TeX 的一个重要原语,并且尝试使用页眉,你会得到非常奇怪的错误。

在此处输入图片描述

相关内容