如何擺脫演算法中的指令(for、do、if ...)?

如何擺脫演算法中的指令(for、do、if ...)?

我正在用 LATEX 寫一篇論文,如圖所示。我嘗試了很多次,但我還沒有展示如何做到這一點。 在此輸入影像描述

我嘗試用​​演算法輸入這個範例,但不能。你能給我一個關於我的問題的提示嗎?謝謝大家!

答案1

您可以使用常規的tabular

在此輸入影像描述

\documentclass{article}

\usepackage{lipsum}
\newcommand{\algvrule}{@{\hspace{.5em}}|@{\hspace{1em}}}

\begin{document}

\lipsum[1]

\noindent
\begin{tabular}{@{} l @{}}
  As before,~$k$ here is a commutative ring. \\
  \begin{tabular}{\algvrule l @{}}
    Hence could be a field of integers~$Z$; these are the usual choices. \\
    \begin{tabular}{\algvrule l @{}}
      Given an infinite variable set $x = (x_1; x_2; \ldots)$, a monomial \\
      $x^p = x_1^a x_2^b \cdots$, is indexed by an element $t = (a; b; \ldots)$ in~$N^\infty$ \\
      having finite support, such~$t$ are called weak compositions.
    \end{tabular} \\
    The nonzero ones among the integers $a; b; \ldots$ are called the parts of the
  \end{tabular} \\
  weak composition~$t$.
\end{tabular}

\lipsum[2]

\end{document}

相關內容