\documentclass{article}
<span style="color:#ff0000;">\usepackage[margin=0in,paperheight=8in, paperwidth=4.3in]{geometry}</span>
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{setspace}
\usepackage{xpatch}
\pagestyle{empty}
\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\xpatchcmd{\algorithmic}{\itemsep\z@}{\itemsep=0ex}{}{}
\makeatother
\begin{document}
% New definitions
\algnewcommand\algorithmicswitch{\textbf{switch}}
\algnewcommand\algorithmiccase{\textbf{case}}
\algnewcommand\algorithmicassert{\texttt{assert}}
\algnewcommand\Assert[1]{\State \algorithmicassert(#1)}%
% New "environments"
\algdef{SE}[SWITCH]{Switch}{EndSwitch}[1]{\algorithmicswitch\ #1\ \algorithmicdo}{\algorithmicend\ \algorithmicswitch}%
\algdef{SE}[CASE]{Case}{EndCase}[1]{\algorithmiccase\ #1}{\algorithmicend\ \algorithmiccase}%
\algtext*{EndSwitch}%
\algtext*{EndCase
[Latex] 如何将latex的伪代码algorithm保存为大小fit的pdf或者图像
最新推荐文章于 2024-09-23 12:21:59 发布