New answers tagged

2

It's done automatically: \documentclass[12pt,a4paper,twoside]{book} \usepackage{graphicx} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm*}[t!] \caption{caption} \begin{algorithmic}[1] \Require{require} \State {test tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt tttt ...


2

You can pass the float option to \lstinputlisting to make it float: \documentclass{article} \usepackage{listings} \lstset{basicstyle=\footnotesize\ttfamily} \usepackage{lipsum} \begin{document} \lipsum[1] \lstinputlisting[caption={Hello}, float]{main.c} \end{document} There's also this question and its answers which have solutions for avoiding page ...


1

Is perhaps this that you want? \documentclass[12pt]{report} \usepackage[ruled,linesnumbered]{algorithm2e} \usepackage{amsmath} \begin{document} \begin{algorithm} \DontPrintSemicolon \caption{BE radix-8 IMML Modular Multiplication}\label{alg1} \KwIn{ $x=\sum_{i=0}^{n-1} x_i\cdot2^i$, $y=\sum_{i=0}^{n-1} y_i\cdot2^i$, $p=\sum_{i=0}^{n-1}p_i\cdot2^i$ ...


0

this is my solution for a one lined for each block \begin{algorithm} \algnewcommand\algorithmiceach{\textbf{each}} \algnewcommand\Each{\algorithmiceach} \algnewcommand{\LineForEach}[2]{ \State\algorithmicfor\ \Each\ {#1}\ \algorithmicdo \ {#2}\ } \begin{algorithmic}[1] \Procedure{my procedure}{} \LineForEach{( condition)}{ what to do}% ...


2

Instead of an enumerate or itemize environment, consider using a plain array environment. (The horizontal bar in the following screenshot is added only to illustrate the width of the textblock.) \documentclass{article} \begin{document} \hrule\smallskip % just to illustrate width of textblock \noindent \begin{minipage}{0.5\textwidth} \centering ...


3

\documentclass{article} \usepackage{listings} \begin{document} \begin{lstlisting}[caption={\textsc{Newton(1,2,5)}}] > 0.0001 > 0.0011 > 0.0111 > 0.1111 > 0.1111 \end{lstlisting} \begin{lstlisting}[caption={\textsc{reciprocal(2,2,5)}}] > 0.0001 > 0.0011 > 0.0111 > 0.1111 > 0.1111 \end{lstlisting} \end{document} An update ...


2

Your problem is that you are missing some closing \EndIf and \EndFor. I have made some changes to your code and indented it properly and I am able to compile it. Also, you are not using the package provided macros correctly. \documentclass{article} \usepackage{algpseudocode} \usepackage{algorithm} \begin{document} \begin{algorithm} \caption{Algorithm ...



Top 50 recent answers are included