序列產生宏

序列產生宏

我正在尋找一個宏,它接受序列的通用術語的輸入並廣泛地編寫該序列。

我的意思是一個命令,\GenSeq{general term}{index}{min index}{max index}例如

\GenSeq{f(i)}{i}{1}{n} 產生

在此輸入影像描述

\GenSeq{f(i)}{i}{k}{n} 產生

在此輸入影像描述

\GenSeq{\theta^{(s)}}{s}{s}{T}

在此輸入影像描述

我想知道這樣的東西是否可以在乳膠中編程

答案1

在此輸入影像描述

\documentclass{article}

\def\GenSeq#1#2#3{%
\def\zz##1{#1}%
\def\zzstart{#2}%
\zz{#2},
\ifx\zzstart\zzzero\zz{1}\else\ifx\zzstart\zzone\zz{2}\else\zz{#2+1}\fi\fi,
\ldots,\zz{#3}}
\def\zzzero{0}
\def\zzone{1}
\begin{document}

\parskip\bigskipamount

$\GenSeq{f(#1)}{1}{n}$

$\GenSeq{f(#1)}{k}{n}$

$\GenSeq{\theta^{(#1)}}{s}{T}$

\end{document}

答案2

一個實現與expl3.

第一個強制參數\GenSeq是一個模板,代表#1「循環」中的目前索引。第二個參數是起點,第三個參數是終點。

如果第二個參數是一個整數(透過正規表示式、零個或一個連字號/減號和一個或多個數字識別),則第二個列印項目將計算索引,否則將為<start point>+1。然而

  1. 若起點和終點重合,則只列印一項;
  2. 若起點是數字,終點也是數字,且相差一到二,則只列印相關項;
  3. 否則,將列印起始項、下一個項目、點和結束項。

使用 時\GenSeq*,將在末尾添加點以表示無限序列。

\documentclass{article}
\usepackage{amsmath}
%\usepackage{xparse} % not needed with LaTeX 2020-10-01 or later

\ExplSyntaxOn

\NewDocumentCommand{\GenSeq}{smmm}
 {% #1 = optional *
  % #2 = template
  % #3 = starting point
  % #4 = end point
  \pinkcollins_genseq:nnn { #2 } { #3 } { #4 }
  \IfBooleanT{#1}{,\dotsc}
 }

\cs_new_protected:Nn \pinkcollins_genseq:nnn
 {
  % turn the template into a (temporary) function
  \cs_set:Nn \__pinkcollins_genseq_temp:n { #1 }
  % do the main work
  \tl_if_eq:nnTF { #2 } { #3 } 
   {% if #2=#3, not much to do
    \__pinkcollins_genseq_temp:n { #2 }
   }
   {% now the hard work
    \__pinkcollins_genseq_do:nn { #2 } { #3 }
   }
 }

\cs_new_protected:Nn \__pinkcollins_genseq_do:nn
 {% #1 = start point, #2 = end point
  % first check whether #1 is an integer
  % \-? = one optional minus sign
  % [[:digit:]]+ = one or more digits
  % \Z = up to the end of the input
  \regex_match:nnTF { \-? [[:digit:]]+ \Z } { #1 }
   {
    \__pinkcollins_genseq_number:nn { #1 } { #2 }
   }
   {
    \__pinkcollins_genseq_symbolic:nn { #1 } { #2 }
   }
 }

\cs_new_protected:Nn \__pinkcollins_genseq_number:nn
 {% #1 = start point, #2 = end point
  \tl_if_eq:enTF { \int_eval:n { #1 + 1 } } { #2 }
   {
    \__pinkcollins_genseq_temp:n { #1 },\__pinkcollins_genseq_temp:n { #2 }
   }
   {
    \__pinkcollins_genseq_temp:n { #1 },
    \__pinkcollins_genseq_temp:n { \int_eval:n { #1+1 } },
    \tl_if_eq:enF { \int_eval:n { #1 + 2 } } { #2 } { \dots, }
    \__pinkcollins_genseq_temp:n { #2 }
   }
 }
\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { e } { T, F, TF }

\cs_new_protected:Nn \__pinkcollins_genseq_symbolic:nn
 {% #1 = start point, #2 = end point
  \__pinkcollins_genseq_temp:n { #1 },
  \__pinkcollins_genseq_temp:n { #1+1 },
  \dots,
  \__pinkcollins_genseq_temp:n { #2 }
 }

\ExplSyntaxOff

\begin{document}

$\GenSeq{f(#1)}{1}{n}$

$\GenSeq{f(#1)}{0}{n}$

$\GenSeq{f(#1)}{1}{1}$

$\GenSeq{f(#1)}{1}{2}$

$\GenSeq{f(#1)}{1}{3}$

$\GenSeq{f(#1)}{1}{4}$

$\GenSeq{f(#1)}{-2}{k}$

$\GenSeq{f(#1)}{k}{n}$

$\GenSeq*{\theta^{(#1)}}{s}{T}$

\end{document}

在此輸入影像描述


-variant的另一種用法*是使序列降序:

\documentclass{article}
\usepackage{amsmath}
%\usepackage{xparse} % not needed with LaTeX 2020-10-01 or later

\ExplSyntaxOn

\NewDocumentCommand{\GenSeq}{smmm}
 {% #1 = optional * for reverse sequence
  % #2 = template
  % #3 = starting point
  % #4 = end point
  \IfBooleanTF{#1}
   {
    \cs_set:Nn \__pinkcollins_genseq_sign: { - }
   }
   {
    \cs_set:Nn \__pinkcollins_genseq_sign: { + }
   }
  \pinkcollins_genseq:nnn { #2 } { #3 } { #4 }
 }

\cs_new_protected:Nn \pinkcollins_genseq:nnn
 {
  % turn the template into a (temporary) function
  \cs_set:Nn \__pinkcollins_genseq_temp:n { #1 }
  % do the main work
  \tl_if_eq:nnTF { #2 } { #3 } 
   {% if #2=#3, not much to do
    \__pinkcollins_genseq_temp:n { #2 }
   }
   {% now the hard work
    \__pinkcollins_genseq_do:nn { #2 } { #3 }
   }
 }

\cs_new_protected:Nn \__pinkcollins_genseq_do:nn
 {% #1 = start point, #2 = end point
  % first check whether #1 is an integer
  % \-? = one optional minus sign
  % [[:digit:]]+ = one or more digits
  % \Z = up to the end of the input
  \regex_match:nnTF { \-? [[:digit:]]+ \Z } { #1 }
   {
    \__pinkcollins_genseq_number:nn { #1 } { #2 }
   }
   {
    \__pinkcollins_genseq_symbolic:nn { #1 } { #2 }
   }
 }

\cs_new_protected:Nn \__pinkcollins_genseq_number:nn
 {% #1 = start point, #2 = end point
  \tl_if_eq:enTF { \int_eval:n { #1 \__pinkcollins_genseq_sign: 1 } } { #2 }
   {
    \__pinkcollins_genseq_temp:n { #1 },\__pinkcollins_genseq_temp:n { #2 }
   }
   {
    \__pinkcollins_genseq_temp:n { #1 },
    \__pinkcollins_genseq_temp:n { \int_eval:n { #1\__pinkcollins_genseq_sign: 1 } },
    \tl_if_eq:enF { \int_eval:n { #1 \__pinkcollins_genseq_sign: 2 } } { #2 } { \dots, }
    \__pinkcollins_genseq_temp:n { #2 }
   }
 }
\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { e } { T, F, TF }

\cs_new_protected:Nn \__pinkcollins_genseq_symbolic:nn
 {% #1 = start point, #2 = end point
  \__pinkcollins_genseq_temp:n { #1 },
  \__pinkcollins_genseq_temp:n { #1\__pinkcollins_genseq_sign:1 },
  \dots,
  \__pinkcollins_genseq_temp:n { #2 }
 }

\ExplSyntaxOff

\begin{document}

\textbf{Ascending}

$\GenSeq{f(#1)}{1}{n}$

$\GenSeq{f(#1)}{0}{n}$

$\GenSeq{f(#1)}{1}{1}$

$\GenSeq{f(#1)}{1}{2}$

$\GenSeq{f(#1)}{1}{3}$

$\GenSeq{f(#1)}{1}{4}$

$\GenSeq{f(#1)}{-2}{k}$

$\GenSeq{f(#1)}{k}{n}$

$\GenSeq{\theta^{(#1)}}{s}{T}$

\textbf{Descending}

$\GenSeq*{f(#1)}{n}{1}$

$\GenSeq*{f(#1)}{n}{0}$

$\GenSeq*{f(#1)}{1}{1}$

$\GenSeq*{f(#1)}{2}{1}$

$\GenSeq*{f(#1)}{3}{1}$

$\GenSeq*{f(#1)}{4}{1}$

$\GenSeq*{f(#1)}{k}{-2}$

$\GenSeq*{f(#1)}{k}{n}$

$\GenSeq*{\theta^{(#1)}}{s}{T}$

\end{document}

在此輸入影像描述

答案3

為了玩得開心,我想用 expl3 來做。

但我最終使用了 expl3 和我自己的程式碼的混合來做到這一點:

  • 我使用 expl3-regex-code 來檢查是否⟨最小索引⟩—⁠(!)⁠ ⁠不擴展標記⟨最小索引⟩⁠ ⁠(!)⁠ — 形成最多一個符號和一些十進制數字的序列,並且 — 如果是的話 — 用於遞增並將 (遞增的) 值傳遞給替換例程⟨最小索引⟩
  • 我用我自己的程式碼來替換⟨指數⟩之內⟨一般術語⟩

⟨最小索引⟩不會擴展以檢查它是否表示/產生(僅)有效的 TeX-⟨數字⟩-數量。我拒絕這種檢查/測試的想法,原因如下:沒有用於檢查是否完全擴展的測試方法⟨最小索引⟩僅產生有效的 TeX-⟨數字⟩我知道 -quantity 在某種程度上沒有缺陷和/或對可能的用戶輸入沒有限制。當嘗試實現此類測試的演算法時,您將面臨停止問題:在擴展它們時,形成的標記⟨最小索引⟩可以形成任意基於擴展的演算法。讓演算法檢查這樣的演算法最終是否產生有效的 TeX-⟨數字⟩-quantity 意味著讓演算法檢查其他任意演算法是否完全終止/終止時沒有錯誤訊息。這就是停機問題。艾倫·圖靈於 1936 年證明不可能實現對於任何任意演算法都可以「決定」該演算法是否會終止的演算法。

一開始我打算替換⟨指數⟩透過 expl3-routines 還可以:

第七部分 - l3tl 包 - 令牌列表, 部分3 修改token列表變數介面3.pdf(2020年10月27日發布)指出:

\tl_replace_all:Nnn ⟨tl var⟩ {⟨old tokens⟩} {⟨new tokens⟩}

取代所有出現的情況⟨舊代幣⟩在裡面⟨tl 變數⟩⟨新代幣⟩⟨舊代幣⟩不能包含{, }or #(更準確地說,是類別代碼為 1(開始組)或 2(結束組)的顯式字元標記,以及類別代碼為 6 的標記)。由於函數從左到右運行,因此該模式⟨舊代幣⟩更換後可能會保留(請參閱\tl_remove_all:Nn範例)。

(您被告知類別代碼 1 是“開始組”,類別代碼 2 是“結束組”。我想知道為什麼您沒有被告知類別代碼 6 是“參數”。;-))

我嘗試用​​ 來做\tl_replace_all:Nnn

但這失敗了,因為該聲明不真實。

(你可以自己測試:

在下面的範例中,並非所有出現的 都u被替換為d

\documentclass{article}
\usepackage{expl3}
\ExplSyntaxOn
\tl_set:Nn \l_tmpa_tl {uu{uu}uu{uu}}
\tl_replace_all:Nnn \l_tmpa_tl {u} {d}
\tl_show:N \l_tmpa_tl
\stop

⟨舊代幣⟩u
⟨新代幣⟩d
所有限制⟨舊代幣⟩⟨新代幣⟩被服從。

控制台輸出為:

\l_tmpa_tl=dd{uu}dd{uu}.

似乎只有未嵌套在具有類別代碼 1(開始組)和 2(結束組)的一對匹配顯式字元標記之間的出現才會被替換。

所以所有出現的地方都被替換的說法是錯的。

如果該語句正確,那麼控制台輸出將會是:

\l_tmpa_tl=dd{dd}dd{dd}.

\ReplaceAllIndexOcurrences所以我決定從頭開始編寫我自己的替換例程,而不使用 expl3。

作為副作用,\ReplaceAllIndexOcurrences確實將類別代碼 1 的所有明確字元標記替換為 ,將類別代碼 2 的所有明確字元標記替換為。{1}2

\documentclass[landscape, a4paper]{article}

%===================[adjust margins/layout for the example]====================
\csname @ifundefined\endcsname{pagewidth}{}{\pagewidth=\paperwidth}%
\csname @ifundefined\endcsname{pdfpagewidth}{}{\pdfpagewidth=\paperwidth}%
\csname @ifundefined\endcsname{pageheight}{}{\pageheight=\paperheight}%
\csname @ifundefined\endcsname{pdfpageheight}{}{\pdfpageheight=\paperheight}%
\textwidth=\paperwidth
\oddsidemargin=1.5cm
\marginparsep=.2\oddsidemargin
\marginparwidth=\oddsidemargin
\advance\marginparwidth-2\marginparsep
\advance\textwidth-2\oddsidemargin
\advance\oddsidemargin-1in
\evensidemargin=\oddsidemargin
\textheight=\paperheight
\topmargin=1.5cm
\footskip=.5\topmargin
{\normalfont\global\advance\footskip.5\ht\strutbox}%
\advance\textheight-2\topmargin
\advance\topmargin-1in
\headheight=0ex
\headsep=0ex
\pagestyle{plain}
\parindent=0ex
\parskip=0ex 
\topsep=0ex
\partopsep=0ex
%==================[eof margin-adjustments]====================================

\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand\GenSeq{mmmm}{
  \group_begin:
  % #1 = general term
  % #2 = index
  % #3 = min index
  % #4 = max index
  \regex_match:nnTF { ^[\+\-]?\d+$ }{ #3 }{
    \int_step_inline:nnnn {#3}{1}{#3+1}{\ReplaceAllIndexOcurrences{#1}{#2}{##1},}
  }{
   \ReplaceAllIndexOcurrences{#1}{#2}{#3},
   \ReplaceAllIndexOcurrences{#1}{#2}{#3+1},
  }
  \ldots,
  \ReplaceAllIndexOcurrences{#1}{#2}{#4}
  \group_end:
}
\ExplSyntaxOff

\makeatletter
%%//////////////////// Code of my own replacement-routine: ////////////////////
%%=============================================================================
%% Paraphernalia:
%%    \UD@firstoftwo, \UD@secondoftwo,
%%    \UD@PassFirstToSecond, \UD@Exchange, \UD@removespace
%%    \UD@CheckWhetherNull, \UD@CheckWhetherBrace,
%%    \UD@CheckWhetherLeadingTokens, \UD@ExtractFirstArg
%%=============================================================================
\newcommand\UD@firstoftwo[2]{#1}%
\newcommand\UD@secondoftwo[2]{#2}%
\newcommand\UD@PassFirstToSecond[2]{#2{#1}}%
\newcommand\UD@Exchange[2]{#2#1}%
\newcommand\UD@removespace{}\UD@firstoftwo{\def\UD@removespace}{} {}%
%%-----------------------------------------------------------------------------
%% Check whether argument is empty:
%%.............................................................................
%% \UD@CheckWhetherNull{<Argument which is to be checked>}%
%%                     {<Tokens to be delivered in case that argument
%%                       which is to be checked is empty>}%
%%                     {<Tokens to be delivered in case that argument
%%                       which is to be checked is not empty>}%
%%
%% The gist of this macro comes from Robert R. Schneck's \ifempty-macro:
%% <https://groups.google.com/forum/#!original/comp.text.tex/kuOEIQIrElc/lUg37FmhA74J>
\newcommand\UD@CheckWhetherNull[1]{%
  \romannumeral\expandafter\UD@secondoftwo\string{\expandafter
  \UD@secondoftwo\expandafter{\expandafter{\string#1}\expandafter
  \UD@secondoftwo\string}\expandafter\UD@firstoftwo\expandafter{\expandafter
  \UD@secondoftwo\string}\expandafter\z@\UD@secondoftwo}%
  {\expandafter\z@\UD@firstoftwo}%
}%
%%-----------------------------------------------------------------------------
%% Check whether argument's first token is a catcode-1-character
%%.............................................................................
%% \UD@CheckWhetherBrace{<Argument which is to be checked>}%
%%                      {<Tokens to be delivered in case that argument
%%                        which is to be checked has leading
%%                        catcode-1-token>}%
%%                      {<Tokens to be delivered in case that argument
%%                        which is to be checked has no leading
%%                        catcode-1-token>}%
\newcommand\UD@CheckWhetherBrace[1]{%
  \romannumeral\expandafter\UD@secondoftwo\expandafter{\expandafter{%
  \string#1.}\expandafter\UD@firstoftwo\expandafter{\expandafter
  \UD@secondoftwo\string}\expandafter\z@\UD@firstoftwo}%
  {\expandafter\z@\UD@secondoftwo}%
}%
%%-----------------------------------------------------------------------------
%% Check whether argument's leading tokens form a specific 
%% token-sequence that does neither contain explicit character tokens of 
%% category code 1 or 2 nor contain tokens of category code 6:
%%.............................................................................
%% \UD@CheckWhetherLeadingTokens{<argument which is to be checked>}%
%%                              {<a <token sequence> without explicit 
%%                                character tokens of category code
%%                                1 or 2 and without tokens of
%%                                category code 6>}%
%%                              {<internal token-check-macro>}%
%%                              {<tokens to be delivered in case
%%                                <argument which is to be checked> has
%%                                <token sequence> as leading tokens>}%
%%                              {<tokens to be delivered in case 
%%                                <argument which is to be checked>
%%                                does not have <token sequence> as
%%                                leading tokens>}%
\newcommand\UD@CheckWhetherLeadingTokens[3]{%
  \romannumeral\UD@CheckWhetherNull{#1}{\expandafter\z@\UD@secondoftwo}{%
    \expandafter\UD@secondoftwo\string{\expandafter
    \UD@@CheckWhetherLeadingTokens#3{\relax}#1#2}{}}%
}%
\newcommand\UD@@CheckWhetherLeadingTokens[1]{%
  \expandafter\UD@CheckWhetherNull\expandafter{\UD@firstoftwo{}#1}%
  {\UD@Exchange{\UD@firstoftwo}}{\UD@Exchange{\UD@secondoftwo}}%
  {\expandafter\expandafter\expandafter\expandafter
   \expandafter\expandafter\expandafter\z@\expandafter\expandafter
   \expandafter}\expandafter\UD@secondoftwo\expandafter{\string}%
}%
%%-----------------------------------------------------------------------------
%% \UD@internaltokencheckdefiner{<internal token-check-macro>}%
%%                              {<token sequence>}%
%% Defines <internal token-check-macro> to snap everything 
%% until reaching <token sequence>-sequence and spit that out
%% nested in braces.
%%-----------------------------------------------------------------------------
\newcommand\UD@internaltokencheckdefiner[2]{%
  \@ifdefinable#1{\long\def#1##1#2{{##1}}}%
}%
\UD@internaltokencheckdefiner{\UD@InternalExplicitSpaceCheckMacro}{ }%
%%-----------------------------------------------------------------------------
%% Extract first inner undelimited argument:
%%
%%   \romannumeral\UD@ExtractFirstArgLoop{ABCDE\UD@SelDOm} yields  {A}
%%
%%   \romannumeral\UD@ExtractFirstArgLoop{{AB}CDE\UD@SelDOm} yields  {AB}
%%.............................................................................
\@ifdefinable\UD@RemoveTillUD@SelDOm{%
  \long\def\UD@RemoveTillUD@SelDOm#1#2\UD@SelDOm{{#1}}%
}%
\newcommand\UD@ExtractFirstArgLoop[1]{%
  \expandafter\UD@CheckWhetherNull\expandafter{\UD@firstoftwo{}#1}%
  {\z@#1}%
  {\expandafter\UD@ExtractFirstArgLoop\expandafter{\UD@RemoveTillUD@SelDOm#1}}%
}%
%%=============================================================================
%% \ReplaceAllIndexOcurrences{<term with <index>>}
%%                           {<index>}%
%%                           {<replacement for<index>>}%
%%
%% Replaces all <index> in <term with <index>> by <replacement for<index>>
%%
%% !!! Does also replace all pairs of matching explicit character tokens of
%%     catcode 1/2 by matching braces!!!
%% !!! <index> must not contain explicit character tokens of catcode 1 or 2 !!!
%% !!! <index> must not contain tokens of catcode 6 !!!
%% !!! Defines temporary macro \UD@temp, therefore not expandable !!!
%%-----------------------------------------------------------------------------
\newcommand\ReplaceAllIndexOcurrences[2]{%
  % #1 - <term with <index>>
  % #2 - <index>
  \begingroup
  \UD@internaltokencheckdefiner{\UD@temp}{#2}%
  \expandafter\endgroup
  \romannumeral\UD@ReplaceAllIndexOcurrencesLoop{#1}{}{#2}%
}%
\newcommand\UD@ReplaceAllIndexOcurrencesLoop[4]{%
  % Do:
  %  \UD@internaltokencheckdefiner{\UD@temp}{<index>}%
  %  \romannumeral\UD@ReplaceAllIndexOcurrencesLoop
  %                                 {<term with <index>>}%
  %                                 {<sequence created so far, initially empty>}%
  %                                 {<index>}%
  %                                 {<replacement for<index>>}%
  %
  % #1 - <term with <index>>
  % #2 - <sequence created so far, initially empty>
  % #3 - <index>
  % #4 - <replacement for<index>>
  \UD@CheckWhetherNull{#1}{\z@#2}{%
    \UD@CheckWhetherLeadingTokens{#1}{#3}{\UD@temp}{%
      \expandafter\expandafter\expandafter\UD@ReplaceAllIndexOcurrencesLoop
      \expandafter\expandafter\expandafter{%
        \expandafter\UD@firstoftwo\expandafter{\expandafter}\UD@temp#1%
      }{#2#4}%
    }{%
      \UD@CheckWhetherLeadingTokens{#1}{ }{\UD@InternalExplicitSpaceCheckMacro}{%
         \expandafter\UD@ReplaceAllIndexOcurrencesLoop
         \expandafter{\UD@removespace#1}{#2 }%
      }{%
        \UD@CheckWhetherBrace{#1}{%
          \expandafter\expandafter\expandafter\UD@PassFirstToSecond
          \expandafter\expandafter\expandafter{%
          \expandafter\UD@PassFirstToSecond\expandafter{%
            \romannumeral\expandafter\UD@ReplaceAllIndexOcurrencesLoop
              \romannumeral\UD@ExtractFirstArgLoop{#1\UD@SelDOm}{}{#3}{#4}%
          }{#2}}%
          {\expandafter\UD@ReplaceAllIndexOcurrencesLoop\expandafter{\UD@firstoftwo{}#1}}%
        }{%
          \expandafter\UD@PassFirstToSecond\expandafter{%
            \romannumeral\expandafter\UD@Exchange\romannumeral\UD@ExtractFirstArgLoop{#1\UD@SelDOm}{\z@#2}%
          }{\expandafter\UD@ReplaceAllIndexOcurrencesLoop\expandafter{\UD@firstoftwo{}#1}}%
        }%
      }%
    }%
    {#3}{#4}%
  }%
}%
\makeatother
%%=============================================================================
%%///////////////// End of code of my own replacement-routine. ////////////////

\makeatletter
\newcommand\ParenthesesIfMoreThanOneUndelimitedArgument[1]{%
  \begingroup
  \protected@edef\UD@temp{#1}%
  \expandafter\expandafter\expandafter\UD@CheckWhetherNull
  \expandafter\expandafter\expandafter{\expandafter\UD@firstoftwo\UD@temp{}.}{%
    \endgroup#1%
  }{%
    \expandafter\UD@CheckWhetherNull
    \expandafter{\romannumeral\expandafter\expandafter
                              \expandafter            \expandafter
                              \expandafter\expandafter
                              \expandafter            \z@
                              \expandafter\expandafter
                              \expandafter            \UD@firstoftwo
                              \expandafter\UD@firstoftwo
                              \expandafter{%
                              \expandafter}%
                              \UD@temp{}.}{%
      \endgroup#1%
    }{%
      \endgroup(#1)%
    }%
  }%
}%
\makeatother

\begin{document}

Let's use \verb|i| as \textit{$\langle$index$\rangle$}---\verb|$\GenSeq{f(i)}{i}{1}{n}$| yields:

$\GenSeq{f(i)}{i}{1}{n}$

\vfill

Let's use \verb|i| as \textit{$\langle$index$\rangle$}, but \textit{$\langle$min~index$\rangle$} not a digit  sequence---\verb|$\GenSeq{f(i)}{i}{k}{n}$| yields:

$\GenSeq{f(i)}{i}{k}{n}$

\vfill

Let's use \verb|s| as \textit{$\langle$index$\rangle$}---\verb|$\GenSeq{\theta^{(s)}}{s}{s}{T}$| yields:

$\GenSeq{\theta^{(s)}}{s}{s}{T}$

\vfill

Let's use \verb|\Weird\Woozles| as \textit{$\langle$index$\rangle$}---\begin{verbatim}
$\GenSeq{%
          \sqrt{%
            \vphantom{(}%
            ParenthesesIfMoreThanOneUndelimitedArgument{\Weird\Woozles}\cdot\ParenthesesIfMoreThanOneUndelimitedArgument{\Weird\Woozles}%
            \vphantom{)}%
          }%
        }%
        {\Weird\Woozles}%
        {s}%
        {T}$
\end{verbatim} yields:

$\GenSeq{%
          \sqrt{%
            \vphantom{(}%
            \ParenthesesIfMoreThanOneUndelimitedArgument{\Weird\Woozles}\cdot\ParenthesesIfMoreThanOneUndelimitedArgument{\Weird\Woozles}%
            \vphantom{)}%
          }%
        }%
        {\Weird\Woozles}%
        {s}%
        {T}$

\vfill

Let's use the explicit space token as \textit{$\langle$index$\rangle$}---\verb|$\GenSeq{f( )}{ }{k}{n}$| yields:

$\GenSeq{f( )}{ }{k}{n}$

\vfill

Let's use the explicit space token as \textit{$\langle$index$\rangle$}---\verb|$\GenSeq{f( )}{ }{-5}{n}$| yields:

$\GenSeq{f( )}{ }{-5}{n}$

\vfill\vfill

\end{document}

在此輸入影像描述

相關內容