如何对每个短语进行编号,并让较长的短语自动换行?

如何对每个短语进行编号,并让较长的短语自动换行?

我得到了一些帮助这里在 TEX 页面上,并借助以下内容:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\setmainfont{Charis SIL}
\newfontfamily{\bulletfont}{DejaVu Serif}

\usepackage{geometry}
\geometry{a4paper, left=1in, right=1in, top=0.5in, bottom=0.65in}

\NewDocumentCommand{\?}{sm}{%
    \begin{tabular}[b]{@{}c@{}}
        \bulletfont\IfBooleanTF{#1}{\textbullet}{\textbf{\textperiodcentered}}\\[-0.5ex]
        \IfBooleanT{#1}{\bfseries}#2
    \end{tabular}%
}
\NewDocumentCommand{\phrase}{mm}{%
    \par\addvspace{4ex}
    \noindent\begin{tabular}{@{}l@{}}#1\\[0.2ex]#2\end{tabular}%
    \par\addvspace{4ex}
}

\begin{document}
    
    Some explanatory text without any real meaning, just to show the phrases
    in context.
    
    \phrase{\?{Do} \?{you} \?*{want} \?{some} \?*{break}\?{fast}?}
    {dʊ jʊ ˈwɑnt səm ˈbrɛk fəst? ↗}
    
    \phrase{\?{Can} \?{you} \?*{come} \?{in}\?*{side} \?{for} \?{a} \?*{min}\?{ute}?}
    {kæn jʊ ˈkʌm‿ɪnˈsaɪd fər‿ə ˈmɪn ɪt? ↗}
    
    
    \phrase{\?{I'm} \?*{sor}\?{ry} \?{I} \?*{have}\?{n't} \?*{had} \?{the} \?*{chance} \?{to} \?*{call} \?{you} \?*{back.} \?{I'm} \?*{sor}\?{ry} \?{I} \?*{have}\?{n't} \?*{had} \?{the} \?*{chance} \?{to} \?*{call} \?{you} \?*{back.}}
    {(phonetic transcription here)}
    
    Some explanatory text without any real meaning, just to show the phrases
    in context.
    
\end{document}

我可以制作类似这样的作品:

在此处输入图片描述

对于较短的短语,一切看起来都很好,但是当短语太长时,它就会超出页面范围。是否可以让它换行?即使是手动的?我需要处理较长短语的情况很少见,大概 200 个中 1 个,但它确实会发生,我不希望短语超出页面范围。

另外,是否可以对短语进行编号,并保持它们处于相同的缩进级别?就像这样:

     x x x x x x
  1. Phrase phrase
     Phonetic transcription

     x x x x x x
 10. Phrase
     Phonetic transcription

     x x x x x x
100. Phrase
     Phonetic transcription

这是一个更简单的版本:

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\usepackage{geometry}

\setmainfont{Charis SIL}

\geometry{a4paper, left=1in, right=1in, top=0.5in, bottom=0.65in}   

\usepackage{stackengine}
\renewcommand\stacktype{L}

\newcommand{\lstress}[1]
{%
    \stackon{#1}{*}%
}%

\begin{document}
    \lstress{First  Sentence} Second \lstress{First} Second \lstress{First} Second \lstress{First} Second \lstress{First} Second \lstress{First} Second \lstress{First} Second \lstress{First} Second \lstress{First} Second \lstress{First} Second
\end{document}

在此处输入图片描述

答案1

您可以使用 enumerate 添加数字。您可以通过将外部表格替换为 来换行文本\parbox[t]{\linewidth}{...}。数字的(默认)空格是\labelwidth - \labelsep

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
%\usepackage{fontspec}% Sorry, but I hate having to mess with fonts.
%\setmainfont{Charis SIL}
%\newfontfamily{\bulletfont}{DejaVu Serif}

\usepackage{geometry}
\geometry{a4paper, left=1in, right=1in, top=0.5in, bottom=0.65in, showframe}

\NewDocumentCommand{\?}{sm}{%
    \begin{tabular}[b]{@{}c@{}}
        %\bulletfont\IfBooleanTF{#1}{\textbullet}{\textbf{\textperiodcentered}}\\[-0.5ex]
        \IfBooleanTF{#1}{\textbullet}{\textbf{\textperiodcentered}}\\[-0.5ex]
        \IfBooleanT{#1}{\bfseries}#2
    \end{tabular}%
}
\NewDocumentCommand{\phrase}{mm}{%
    %\par\addvspace{4ex}
    \noindent\parbox[t]{\linewidth}{#1\\[0.2ex]#2}%
    %\par\addvspace{4ex}
}

\begin{document}
    
    Some explanatory text without any real meaning, just to show the phrases
    in context.
    
    \begin{enumerate}
    \item \phrase{\?{Do} \?{you} \?*{want} \?{some} \?*{break}\?{fast}?}
    {dʊ jʊ ˈwɑnt səm ˈbrɛk fəst? ↗}
    
    \item \phrase{\?{Can} \?{you} \?*{come} \?{in}\?*{side} \?{for} \?{a} \?*{min}\?{ute}?}
    {kæn jʊ ˈkʌm‿ɪnˈsaɪd fər‿ə ˈmɪn ɪt? ↗}
    
    \setcounter{enumi}{99}%  
    \item \phrase{\?{I'm} \?*{sor}\?{ry} \?{I} \?*{have}\?{n't} \?*{had} \?{the} \?*{chance} \?{to} \?*{call} \?{you} \?*{back.}
      \?{I'm} \?*{sor}\?{ry} \?{I} \?*{have}\?{n't} \?*{had} \?{the} \?*{chance} \?{to} \?*{call} \?{you} \?*{back.}}%
    {(phonetic transcription here)}
    \end{enumerate}
    
    Some explanatory text without any real meaning, just to show the phrases
    in context.
    
\end{document}

相关内容