내가 도움을 많이 받은 latex 예시 코드는 아래 코드이다. 밑에서 출처 확인할 수 있다.
for{}, $수식$, \medskip, \gets, \textbf, \lambda 사용법 익힐 수 있었음

\documentclass{article}
\usepackage[
%utf8,
linesnumbered,ruled,vlined]{algorithm2e}
\usepackage {algpseudocode}
\usepackage{algorithmicx}
\usepackage{algcompatible}
\begin{document}
\begin{algorithm}
%\ContinuedFloat
\caption{My algorithm}
\textbf{Input:} solution,bound, data\_matrix, vehicle\_capacity, demand\_data,k\_max,operations\_data, move\_type,tenure, max\_number\_of\_moves,max\_iter,non\_improvement\_maxiter,itermax,epsilon
\textbf{Output:} \emph{best solution}
\medskip
routes = extract routes from \textbf{solution}
oldfitness = fitness(\textbf{solution})
ls\_move\_type = inversion
best\_solution = routes
\medskip
\For{$0 \leq i \leq$ itermax}{
new\_routes = [ ]
desc = 'normal route'
\For{route \textbf{in} routes}{
n=length(route)
comb = int($\frac{n!}{(n-2)!}$)
\If{$n \geq 4$}{
tabu\_list\_tenure = $\frac{comb}{5}$
ls\_maxiteration = 50
ls\_move\_type = 'inversion'
}
\If{$3 \leq n \leq 4$}{
tabu\_list\_tenure = $\frac{comb}{4}$
ls\_maxiteration = 25
ls\_move\_type = 'relocation'
}
\Else{
append \textbf{route} to \textbf{new\_routes}
desc = 'short route'
}
\medskip
}
some action
}
\Return
\end{algorithm}
\end{document}
https://stackoverflow.com/questions/72349340/latex-nested-loop-not-displaying-correctly
Latex nested loop not displaying correctly
Hi I'm new to latex I use here the Algorithmic package to write my pseudo code the problem I faced is that 'some text' is displayed correctly under the second loop but the 'return' statement which ...
stackoverflow.com
'Linux, etc' 카테고리의 다른 글
| [linux] ftp 21번 포트 열기 (1) | 2023.11.30 |
|---|---|
| virtualenv 가상환경 (0) | 2023.08.28 |
| RuntimeError: CUDA error: all CUDA-capable devices are busy or unavailable (0) | 2022.07.11 |
| [linux] 폴더/파일 찾기 및 vim 에디터 (0) | 2022.05.09 |
| [linux] 포트 port (0) | 2022.05.09 |