我正在尝试得到这个:
我的问题是个空间 之间 null_array
和[n][n]
梅威瑟:
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{amsmath} %
\usepackage{amssymb}
\usepackage[noline,boxed]{algorithm2e}
\usepackage[skins]{tcolorbox}
% real R
\newcommand{\R}{\mathbb{R}}
\begin{document}
\begin{tcolorbox}[blanker,width=(\linewidth-3.5cm)]
\begin{algorithm}[H]
\DontPrintSemicolon
$\text{sim} = \text{null}\_\text{array}\left[n\right]\left[n\right] $ \\
$\text{sum\_prod} = \text{null}\_\text{array}\left[n\right]\left[n\right] $ \\
$\text{sum\_squ} = \text{null}\_\text{array}\left[n\right]\left[n\right] $ \\
$\text{sum\_sqv} = \text{null}\_\text{araay}\left[n\right]\left[n\right] $ \\
\caption{Tex Exchange}
\end{algorithm}
\end{tcolorbox}
\end{document}
答案1
像这样?
对于上述结果,您只需要从算法中删除所有数学内容:
\documentclass{standalone}
\usepackage{amsmath, amssymb}
\usepackage[noline,boxed]{algorithm2e}
\usepackage[skins]{tcolorbox}
% real R
\newcommand{\R}{\mathbb{R}}
\begin{document}
\begin{tcolorbox}[blanker,width=(\linewidth-3.5cm)]
\begin{algorithm}[H]
\DontPrintSemicolon
sim = null array$[n][n]$\\
sum\_prod = null\_array$[n][n]$\\
sum\_squ = null\_array$[n][n]$\\
sum\_sqv = null\_araay$[n][n]$\\
\caption{Tex Exchange}
\end{algorithm}
\end{tcolorbox}
\end{document}
答案2
添加负空间 ( \!
),如\text{null}\_\text{array}\!\left[n\right]
。