\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-03 11:07:04 发布
本文详细介绍了如何在LaTeX环境中,将编写的伪代码algorithm导出为尺寸合适的PDF文件或高质量图像,以便于在报告、论文中方便使用。
摘要由CSDN通过智能技术生成