如果单元格长度超过给定值,则为列指定一行

如果单元格长度超过给定值,则为列指定一行

我的文档最初是由 Python 终端的等宽 Unicode 输出组成的。原始布局使用空格将结果对齐到列中。我指定了列的宽度(以字符为单位),如果结果长于该宽度,则结果将单独显示一行。长结果包括随附图像中名为 Mode Info、Mode Jazz、Qualities 的行。在此处输入图片描述

我决定用 LaTeX 包装这本书,并一直在努力复制我以前的布局。以下部分的工作方式与我想要的非常相似。

在此处输入图片描述

它使用以下表格:

\noindent
\begin{tabular}{l| l|l| l| l| l| l| l}
\\
\hline
Jazz & \cellcolor{C}{1} & \cellcolor{D}{2} & \cellcolor{E}{3} & \cellcolor{F}{4} & \cellcolor{G}{5} & \cellcolor{A}{6} & \cellcolor{B}{7}\\
    Chord & \cellcolor{C}{ma7} & \cellcolor{D}{mi7} & \cellcolor{E}{mi7} & \cellcolor{F}{ma7} & \cellcolor{G}{7} & \cellcolor{A}{mi7} & \cellcolor{B}{⌀7}\\
    Classical & \cellcolor{C}{Ⅰ} & \cellcolor{D}{ⅱ} & \cellcolor{E}{ⅲ} & \cellcolor{F}{Ⅳ} & \cellcolor{G}{Ⅴ} & \cellcolor{A}{ⅵ} & \cellcolor{B}{ⅶ}\\
    Solfege & \cellcolor{C}{Do} & \cellcolor{D}{Re} & \cellcolor{E}{Mi} & \cellcolor{F}{Fa} & \cellcolor{G}{Sol} & \cellcolor{A}{La} & \cellcolor{B}{Ti}\\
    Set & \cellcolor{C}{0} & \cellcolor{D}{2} & \cellcolor{E}{4} & \cellcolor{F}{5} & \cellcolor{G}{7} & \cellcolor{A}{9} & \cellcolor{B}{11}\\
    Notation & \cellcolor{C}{S} & \cellcolor{D}{R2} & \cellcolor{E}{G3} & \cellcolor{F}{M1} & \cellcolor{G}{P} & \cellcolor{A}{D2} & \cellcolor{B}{N3}\\
    Mneumonic & \cellcolor{C}{Sa} & \cellcolor{D}{Ri} & \cellcolor{E}{Gu} & \cellcolor{F}{Ma} & \cellcolor{G}{Pa} & \cellcolor{A}{Di} & \cellcolor{B}{Nu}\\
    Key Of B♯ & \cellcolor{C}{B♯} & \cellcolor{D}{C♯♯} & \cellcolor{E}{D♯♯} & \cellcolor{F}{E♯} & \cellcolor{G}{F♯♯} & \cellcolor{A}{G♯♯} & \cellcolor{B}{A♯♯}\\
    Key Of C & \cellcolor{C}{C} & \cellcolor{D}{D} & \cellcolor{E}{E} & \cellcolor{F}{F} & \cellcolor{G}{G} & \cellcolor{A}{A} & \cellcolor{B}{B}\\
    Key Of C♯ & \cellcolor{Db}{C♯} & \cellcolor{Eb}{D♯} & \cellcolor{F}{E♯} & \cellcolor{Gb}{F♯} & \cellcolor{Ab}{G♯} & \cellcolor{Bb}{A♯} & \cellcolor{C}{B♯}\\
    Key Of D♭ & \cellcolor{Db}{D♭} & \cellcolor{Eb}{E♭} & \cellcolor{F}{F} & \cellcolor{Gb}{G♭} & \cellcolor{Ab}{A♭} & \cellcolor{Bb}{B♭} & \cellcolor{C}{C}\\
    Key Of D & \cellcolor{D}{D} & \cellcolor{E}{E} & \cellcolor{Gb}{F♯} & \cellcolor{G}{G} & \cellcolor{A}{A} & \cellcolor{B}{B} & \cellcolor{Db}{C♯}\\
    Key Of D♯ & \cellcolor{Eb}{D♯} & \cellcolor{F}{E♯} & \cellcolor{G}{F♯♯} & \cellcolor{Ab}{G♯} & \cellcolor{Bb}{A♯} & \cellcolor{C}{B♯} & \cellcolor{D}{C♯♯}\\
    Key Of E♭ & \cellcolor{Eb}{E♭} & \cellcolor{F}{F} & \cellcolor{G}{G} & \cellcolor{Ab}{A♭} & \cellcolor{Bb}{B♭} & \cellcolor{C}{C} & \cellcolor{D}{D}\\
    Key Of E & \cellcolor{E}{E} & \cellcolor{Gb}{F♯} & \cellcolor{Ab}{G♯} & \cellcolor{A}{A} & \cellcolor{B}{B} & \cellcolor{Db}{C♯} & \cellcolor{Eb}{D♯}\\'
    Key Of F♭ & \cellcolor{E}{F♭} & \cellcolor{Gb}{G♭} & \cellcolor{Ab}{A♭} & \cellcolor{A}{B♭♭} & \cellcolor{B}{C♭} & \cellcolor{Db}{D♭} & \cellcolor{Eb}{E♭}\\
    Key Of E♯ & \cellcolor{F}{E♯} & \cellcolor{G}{F♯♯} & \cellcolor{A}{G♯♯} & \cellcolor{Bb}{A♯} & \cellcolor{C}{B♯} & \cellcolor{D}{C♯♯} & \cellcolor{E}{D♯♯}\\
    Key Of F & \cellcolor{F}{F} & \cellcolor{G}{G} & \cellcolor{A}{A} & \cellcolor{Bb}{B♭} & \cellcolor{C}{C} & \cellcolor{D}{D} & \cellcolor{E}{E}\\
    Key Of F♯ & \cellcolor{Gb}{F♯} & \cellcolor{Ab}{G♯} & \cellcolor{Bb}{A♯} & \cellcolor{B}{B} & \cellcolor{Db}{C♯} & \cellcolor{Eb}{D♯} & \cellcolor{F}{E♯}\\
    Key Of G♭ & \cellcolor{Gb}{G♭} & \cellcolor{Ab}{A♭} & \cellcolor{Bb}{B♭} & \cellcolor{B}{C♭} & \cellcolor{Db}{D♭} & \cellcolor{Eb}{E♭} & \cellcolor{F}{F}\\
    Key Of G & \cellcolor{G}{G} & \cellcolor{A}{A} & \cellcolor{B}{B} & \cellcolor{C}{C} & \cellcolor{D}{D} & \cellcolor{E}{E} & \cellcolor{Gb}{F♯}\\
    Key Of G♯ & \cellcolor{Ab}{G♯} & \cellcolor{Bb}{A♯} & \cellcolor{C}{B♯} & \cellcolor{Db}{C♯} & \cellcolor{Eb}{D♯} & \cellcolor{F}{E♯} & \cellcolor{G}{F♯♯}\\
    Key Of A♭ & \cellcolor{Ab}{A♭} & \cellcolor{Bb}{B♭} & \cellcolor{C}{C} & \cellcolor{Db}{D♭} & \cellcolor{Eb}{E♭} & \cellcolor{F}{F} & \cellcolor{G}{G}\\
    Key Of A & \cellcolor{A}{A} & \cellcolor{B}{B} & \cellcolor{Db}{C♯} & \cellcolor{D}{D} & \cellcolor{E}{E} & \cellcolor{Gb}{F♯} & \cellcolor{Ab}{G♯}\\
    Key Of A♯ & \cellcolor{Bb}{A♯} & \cellcolor{C}{B♯} & \cellcolor{D}{C♯♯} & \cellcolor{Eb}{D♯} & \cellcolor{F}{E♯} & \cellcolor{G}{F♯♯} & \cellcolor{A}{G♯♯}\\
    Key Of B♭ & \cellcolor{Bb}{B♭} & \cellcolor{C}{C} & \cellcolor{D}{D} & \cellcolor{Eb}{E♭} & \cellcolor{F}{F} & \cellcolor{G}{G} & \cellcolor{A}{A}\\
    Key Of B & \cellcolor{B}{B} & \cellcolor{Db}{C♯} & \cellcolor{Eb}{D♯} & \cellcolor{E}{E} & \cellcolor{Gb}{F♯} & \cellcolor{Ab}{G♯} & \cellcolor{Bb}{A♯}\\
    Key Of C♭ & \cellcolor{B}{C♭} & \cellcolor{Db}{D♭} & \cellcolor{Eb}{E♭} & \cellcolor{E}{F♭} & \cellcolor{Gb}{G♭} & \cellcolor{Ab}{A♭} & \cellcolor{Bb}{B♭}\\
    Chord 

相关内容