
如何在文字之間繪製兩條線,如圖所示。這是我的程式碼
\documentclass{article}
\thispagestyle{empty}
\usepackage{lipsum}
\begin{document}
\noindent\rule[0.5ex]{\linewidth}{1pt}
Algorithm Use iteration to find general solution
\noindent\rule[0.5ex]{\linewidth}{1pt}
fator $a$,$b$
$y=a+bx$
\noindent\rule[0.5ex]{\linewidth}{1pt}
\end{document}
答案1
我可以建議替代方案嗎?使用algorithmic
包,您可以在此處找到更多信息演算法。產生兩個圖像:一個來自您的程式碼,另一個是基於 OP 圖像的範例。
\documentclass[10pt,a4paper]{article}
\usepackage{algorithmic}
\usepackage{algorithm}
\begin{document}
% Your code
\noindent\rule[0.5ex]{\linewidth}{1pt}
Algorithm Use iteration to find general solution
\noindent\rule[0.5ex]{\linewidth}{1pt}
factor $a$,$b$
$y=a+bx$
\noindent\rule[0.5ex]{\linewidth}{1pt}
% alternative
\begin{algorithm}
\caption{Use iteration to find the general solution of the ODE in Example 1.4}\label{abc}
\begin{algorithmic}[1]
\STATE factor \textbf{a,b};
\STATE {\textbf {y:=a+b*x}};
\FOR {\textbf{n:=1:4 do write}}
\STATE {\textbf{y:=a+b*x-int(int(y,x),x)}}
\ENDFOR
\end{algorithmic}
\end{algorithm}
\end{document}