精華區beta LaTeX 關於我們 聯絡資訊
※ 引述《edw.bbs@bbs.cs.nthu.edu.tw (edw)》之銘言: : 我想要做出 : do { : ... : ... : } while (1) : 我是用 這兩個 package, 不過好像不支援 : \usepackage{algorithm} : \usepackage{algorithmic} : 只能做出 : while (){ : .... : .... : } : 謝謝 manual 看起來的確是不支援,用 \REPEAT <text> \UNTIL {<condition>} 可以嗎? 如果一定要 do-while 而你用不到 repeat-until 的話,可以這樣試試: \renewcommand{\algorithmicrepeat}{\textbf{do}} \renewcommand{\algorithmicuntil}{\textbf{while}} \newcommand{\DO}{\REPEAT} \newcommand{\ASLONGAS}{\UNTIL} % 非常亂來的幹法,這樣再也不能用 repeat-until % 這個 while 要用另一個名字,不然原來的 while 也毀了 \begin{algorithm}[htbp] \caption{test} \begin{algorithmic}[1] \DO \STATE do this \ASLONGAS {you are able to} \end{algorithmic} \end{algorithm} -- Stay hungry Stay foolish -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 138.23.2.34