You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LaTeX algorithm2e宏包vlined参数未生效问题求助

algorithm2e vlined模式下垂直边界线无水平结束标记修复

复现代码

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[vlined,linesnumbered,ruled,noend]{algorithm2e}

\begin{document}
     \NoCaptionOfAlgo
     \begin{algorithm}
     \SetKwInOut{Input}{Input}
     \SetKwInOut{Output}{Output}

     \If{true}
     {
         test
     }
     \caption{test}
     \end{algorithm}

\end{document} 

效果对比

  • 预期效果(手册示例):
    vlined模式预期效果
  • 实际异常输出:
    当前异常编译结果

根因

宏包加载时同时传入了vlined和noend两个效果互斥的参数:

  • vlined:启用带末端水平标记的垂直线作为代码块边界
  • noend:全局移除所有代码块的结束标记,会直接覆盖vlined模式下的边线末端水平标记

修复方案

删除algorithm2e宏包加载参数中的noend选项,修改后加载语句为:

\usepackage[vlined,linesnumbered,ruled]{algorithm2e}

重新编译即可得到符合手册说明的正确样式。

内容的提问来源于stack exchange,提问作者Johannes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.28 04:18:16