\documentclass[twocolumn]{ltxdoc}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath} %
\usepackage{lineno}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{lipsum}
\usepackage[margin=1in]{geometry}
\documentclass{article}
\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
\usepackage{fancyvrb}
\usepackage{fvextra}
\begin{document}
\begin{algorithm}[H]
\caption{xxx}
\label{alg:algorithm1}
\begin{algorithmic}[1]
\Require
$MRKG$, ($NT$)
\Ensure
$D_n$;
\State Load initial $MRKG$, New Task ($NT$);
\end{algorithmic}
\end{algorithm}
\end{document}
如您所见,我的文本中的 MRKG 太稀疏了。有什么方法可以让它不那么稀疏吗
当我按照 samcarter_is_at_topanswers.xyz 答案进行修改时
\documentclass[twocolumn]{ltxdoc}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath} %
\usepackage{lineno}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{lipsum}
\usepackage[margin=1in]{geometry}
\documentclass{article}
\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
\usepackage{fancyvrb}
\usepackage{fvextra}
\begin{document}
\begin{algorithm}[H]
\RemovePeriod\caption{Stage 1 - Decision-making process for reconfiguration}
\label{alg:algorithm1}
\begin{algorithmic}[1]
\If{\emph(BoP) $!=$ \emph{Null}}
\State \emph{BoPs}.add(\emph{BoP})
\end{algorithmic}
\end{algorithm}
\end{document}
答案1
您可以在数学模式下设置它。数学模式会删除字母之间的正常字距。如果您不想要这个,请不要将其置于数学模式。
如果您的目标是使用斜体字体,则可以使用等\emph{...}
。\textit{...}
\documentclass[twocolumn]{ltxdoc}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath} %
\usepackage{lineno}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{lipsum}
\usepackage[margin=1in]{geometry}
%\documentclass{article}
\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
\usepackage{fancyvrb}
\usepackage{fvextra}
\begin{document}
\begin{algorithm}[H]
\caption{xxx}
\label{alg:algorithm1}
\begin{algorithmic}[1]
\Require
\emph{MRKG}, (\emph{NT})
\Ensure
$D_n$;
\State Load initial \emph{MRKG}, New Task (\emph{NT});
\end{algorithmic}
\end{algorithm}
\end{document}
答案2
如果您认为 MRKG 和 NT 是数学多字母标识符,请使用\mathit
。
\documentclass[twocolumn]{article}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath}
\usepackage{lineno}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[margin=1in]{geometry}
\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
\begin{document}
\begin{algorithm}[H]
\caption{xxx}
\label{alg:algorithm1}
\begin{algorithmic}[1]
\Require
$\mathit{MRKG}$, ($\mathit{NT}$)
\Ensure
$D_n$;
\State Load initial $\mathit{MRKG}$, New Task ($\mathit{NT}$);
\end{algorithmic}
\end{algorithm}
\end{document}