您将如何在 TeXworks 上排版此类内容?

您将如何在 TeXworks 上排版此类内容?

是 TeXbook (第 411 页) 中出现的示例之一,我尝试排版,但失败了。我是新手,希望有人能帮忙,好吗?

该代码据称是:

\input concert
\tsaologo
\medskip
\centerline{Friday, November 19, 1982, 8:00 p.m.}
\bigskip
\centerline{\bf PROGRAM}
\medskip
\composition{Variations on a Theme by Tchaikovsky}
\composer{Anton S. Arensky (1861--1906)}
\smallskip
{\medtype
\movements{Tema: Moderato\cr
Var.~I: Un poco pi\`u mosso&Var.~V: Andante\cr
Var.~II: Allegro non troppo&Var.~VI: Allegro con spirito\cr
Var.~III: Andantino tranquillo&Var.~VII: Andante con moto\cr
Var.~IV: Vivace&Coda: Moderato\cr}
}
\bigskip
\composition{Concerto for Horn and Hardart, S.\,27}
\composer{P. D. Q. Bach (1807--1742)?}
\smallskip
\movements{Allegro con brillo\cr
Tema con variazione \(su un tema differente)\cr
Menuetto con panna e zucchero\cr}
\medskip
\soloists{Ben Lee User, horn\cr
Peter Schickele, hardart\cr}
\bigskip
\centerline{INTERMISSION}
\bigskip
\composition{Symphony No.\,3 in E\flat\ Major\cr
Op.\,55, ``The Eroica''\cr}
\composer{Ludwig van Beethoven (1770--1827)}
\smallskip
\movements{Allegro con brio\cr
Marcia funebre: Adagio assai\cr
Scherzo: Allegro vivace\cr
Finale: Allegro molto\cr}
\bigskip
\smalltype \noindent
Members of the audience are kindly requested to turn off the
alarms on their digital watches, and to cough only between movements.
\bye

在输入代码(b/w 和\begin)之前\end,我输入的是以下内容:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{calc}
\headheight -0.5in
\textheight 9.5in
\begin{document}
\end{document}

此外,这些宏(或定义 - 我不知道它们是否是同一个东西)也要使用:

\def\composition#1{\halign{\bf\quad##\hfil\cr
\kern-1em#1\crcr}} % use \cr's if more than one line
\def\composer#1{\rightline{\bf#1}}
\def\movements#1{\halign{\quad\it##\hfil&&\qquad\it##\hfil\cr#1\crcr}}
\def\soloists#1{\centerline{\bf\vbox{\halign{##\hfil\cr#1\crcr}}}}

\def\tsaologo{\vbox{\bigtype\bf
\line{\hrulefill}
\kern-.5\baselineskip
\line{\hrulefill\phantom{ THE ST.\,ANFORD ORCHESTRA }\hrulefill}
\kern-.5\baselineskip
\line{\hrulefill\hbox{ THE ST.\,ANFORD ORCHESTRA }\hrulefill}
\kern-.5\baselineskip
\line{\hrulefill\phantom{ R. J. Drofnats, Conductor }\hrulefill}
\kern-.5\baselineskip
\line{\hrulefill\hbox{ R. J. Drofnats, Conductor }\hrulefill}
}}

我注意到我可以使用一些定义。例如,当我尝试使用时出现错误,\tsaologo\composition{Variations on a Theme by Tchaikovsky}运行正常。此外,\centerline命令不起作用,但只是\center

答案1

正如其他人所评论的,TeXbook 讨论了 TeX 原语还有一种可能的方法,可以通过一个宏包在更高层次上使用它们纯 TeX,这与 LaTeX 有很大不同。

如果您想更熟练地掌握 LaTeX 编程,阅读 TeXbook 会很有用。对于使用 LaTeX 创建文档,一个很好的起点是“关于 LaTeX 的简单介绍”提供多种语言版本;请访问http://texdoc.netlshort并在框中输入。

不太混合的 LaTeX 形式如下

\documentclass[a4paper,12pt]{article}
\usepackage[top=1cm,bottom=3cm]{geometry}
\usepackage{array}

\pagestyle{empty}
\parindent=0pt

\newcommand{\composition}[1]{%
  \par
  {\bfseries
   \begin{tabular}{@{\hspace{1em}}l@{}}
   \hspace*{-1em}#1%
   \end{tabular}%
  }%
  \par
} % use \\ if more than one line
\newcommand{\composer}[1]{\par\makebox[\textwidth][r]{\bfseries#1}\par}
%\def\composer#1{\rightline{\bfseries#1}}
\newcommand{\movements}[1]{%
  \par
  \begin{tabular}{@{\quad}>{\itshape}l@{\qquad}>{\itshape}l@{}}
  #1
  \end{tabular}
  \par
}
\newcommand{\soloists}[1]{%
  \par
  \makebox[\textwidth][c]{\bfseries\begin{tabular}{@{}c@{}}#1\end{tabular}}
  \par
}

\makeatletter
\newcommand{\textflat}{%
  {\if b\expandafter\@car\f@series\@nil\boldmath\fi$\flat$}%
}
\makeatother

\def\tsaologo{\vbox{\Large\bfseries
\hbox to \hsize{\hrulefill}
\kern-.5\baselineskip
\hbox to \hsize{\hrulefill\phantom{ THE ST.\,ANFORD ORCHESTRA }\hrulefill}
\kern-.5\baselineskip
\hbox to \hsize{\hrulefill\hbox{ THE ST.\,ANFORD ORCHESTRA }\hrulefill}
\kern-.5\baselineskip
\hbox to \hsize{\hrulefill\phantom{ R. J. Drofnats, Conductor }\hrulefill}
\kern-.5\baselineskip
\hbox to \hsize{\hrulefill\hbox{ R. J. Drofnats, Conductor }\hrulefill}
}}
\begin{document}

\tsaologo

\medskip

\centerline{Friday, November 19, 1982, 8:00 p.m.}

\bigskip

\centerline{\bfseries PROGRAM}

\medskip

\composition{Variations on a Theme by Tchaikovsky}
\composer{Anton S. Arensky (1861--1906)}
\smallskip
{\small
\movements{Tema: Moderato\\
Var.~I: Un poco pi\`u mosso    & Var.~V: Andante\\
Var.~II: Allegro non troppo    & Var.~VI: Allegro con spirito\\
Var.~III: Andantino tranquillo & Var.~VII: Andante con moto\\
Var.~IV: Vivace&Coda: Moderato}
}

\bigskip

\composition{Concerto for Horn and Hardart, S.\,27}
\composer{P. D. Q. Bach (1807--1742)?}
\smallskip
\movements{Allegro con brillo\\
Tema con variazione \textup{(}su un tema differente\textup{)}\\
Menuetto con panna e zucchero\\}
\medskip
\soloists{Ben Lee User, horn\\
Peter Schickele, hardart}

\bigskip
\centerline{INTERMISSION}
\bigskip

\composition{Symphony No.\,3 in E\textflat\ Major\\
Op.\,55, ``The Eroica''\\}
\composer{Ludwig van Beethoven (1770--1827)}
\smallskip
\movements{Allegro con brio\\
Marcia funebre: Adagio assai\\
Scherzo: Allegro vivace\\
Finale: Allegro molto\\}

\vfill

\footnotesize
Members of the audience are kindly requested to turn off the
alarms on their digital watches, and to cough only between movements.

\newpage

\end{document}

\tsaologo保留了宏,用纯 LaTeX 命令很难生成它。当然,你可以从 TikZ 中获益。

答案2

出现问题的原因可能是原始代码是为 TeX 编写的,而不是 LaTeX。这是一个有效的混合解决方案(仍然包含大部分 TeX 代码):

在此处输入图片描述

\documentclass[12pt]{article}

\def\tsaologo{\vbox{\large\bfseries
  \noindent\hrulefill\par
  \kern-.5\baselineskip
  \noindent\hrulefill\phantom{ THE ST.\,ANFORD ORCHESTRA }\hrulefill\par
  \kern-.5\baselineskip
  \noindent\hrulefill\hbox{ THE ST.\,ANFORD ORCHESTRA }\hrulefill\par
  \kern-.5\baselineskip
  \noindent\hrulefill\phantom{ R.\ J.\ Drofnats, Conductor }\hrulefill\par
  \kern-.5\baselineskip
  \noindent\hrulefill\hbox{ R.\ J.\ Drofnats, Conductor }\hrulefill
}}

\def\composition#1{\halign{\bfseries\quad##\hfil\cr
\kern-1em#1\crcr}} % use \cr's if more than one line
\def\composer#1{\rightline{\bfseries#1}}
\def\movements#1{\halign{\quad\itshape##\hfil&&\qquad\itshape##\hfil\cr#1\crcr}}
\def\soloists#1{\centerline{\bfseries\vbox{\halign{##\hfil\cr#1\crcr}}}}

\begin{document}

%\input concert% Definitions given in preamble
\tsaologo
\medskip
\centerline{Friday, November 19, 1982, 8:00 p.m.}
\bigskip
\centerline{\bfseries PROGRAM}
\medskip
\composition{Variations on a Theme by Tchaikovsky}
\composer{Anton S. Arensky (1861--1906)}
\smallskip
{\normalsize
  \movements{Tema: Moderato\cr
    Var.~I: Un poco pi\`u mosso&Var.~V: Andante\cr
    Var.~II: Allegro non troppo&Var.~VI: Allegro con spirito\cr
    Var.~III: Andantino tranquillo&Var.~VII: Andante con moto\cr
    Var.~IV: Vivace&Coda: Moderato\cr}
}
\bigskip
\composition{Concerto for Horn and Hardart, S.\,27}
\composer{P. D. Q. Bach (1807--1742)?}
\smallskip
\movements{Allegro con brillo\cr
  Tema con variazione $($su un tema differente$)$\cr
  Menuetto con panna e zucchero\cr}
\medskip
\soloists{Ben Lee User, horn\cr
  Peter Schickele, hardart\cr}
\bigskip
\centerline{INTERMISSION}
\bigskip
\composition{Symphony No.\,3 in E$\flat$\ Major\cr
  Op.\,55, ``The Eroica''\cr}
\composer{Ludwig van Beethoven (1770--1827)}
\smallskip
\movements{Allegro con brio\cr
  Marcia funebre: Adagio assai\cr
  Scherzo: Allegro vivace\cr
  Finale: Allegro molto\cr}
\bigskip
\small \noindent
Members of the audience are kindly requested to turn off the
alarms on their digital watches, and to cough only between movements.

\end{document}

大部分更改都涉及字体选择。请参阅\textit我使用或\it\bfseries等有关系吗\bf和/或两个字母的字体样式命令(\bf,,\it...)会在 LaTeX 中复活吗?

相关内容