0

How to make algorithm bar shorter?

    \begin{algorithm}[H]        
    \caption{Exact Invariant Simulator} 
    \begin{algorithmic}[H] \label{alg:eisim}
        \FOR{$r \in \{1,2,...,R\}$}
        \STATE Sample $\theta_i^{(1,r)}$ from $\theta_i\sim p(\theta_i)$
        \STATE Sample $Y^{(1,r)}\sim p(\cdot|\theta_i^{(1,r)})$
        \FOR{$s \in \{2,3,..,S\}$}
        \STATE Sample $\theta_i^{(s,r)}$ from $\theta_i\sim K_i(\cdot|\theta_{-i}^{(s-1,r)})$
        \ENDFOR
        \STATE Calculate test statistic $T(\theta^{(S,r)}, Y^{(S,r)})$ \footnotemark
        \ENDFOR 
    \end{algorithmic}
\end{algorithm}

This gives

enter image description here

But the black lines are too long. How to make it shorter?

  • How can I change this? – ZHU Aug 29 '18 at 3:37
1

I stand corrected. You CAN put an [H] float inside a minipage.

\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{showframe}
\begin{document}
\noindent\hfil\begin{minipage}{0.6\textwidth}
\begin{algorithm}[H]
    \caption{Exact Invariant Simulator} \label{alg:eisim}
    \begin{algorithmic} 
        \FOR{$r \in \{1,2,...,R\}$}
        \STATE Sample $\theta_i^{(1,r)}$ from $\theta_i\sim p(\theta_i)$
        \STATE Sample $Y^{(1,r)}\sim p(\cdot|\theta_i^{(1,r)})$
        \FOR{$s \in \{2,3,..,S\}$}
        \STATE Sample $\theta_i^{(s,r)}$ from $\theta_i\sim K_i(\cdot|\theta_{-i}^{(s-1,r)})$
        \ENDFOR
        \STATE Calculate test statistic $T(\theta^{(S,r)}, Y^{(S,r)})$ \footnotemark
        \ENDFOR 
    \end{algorithmic}
\end{algorithm}
\end{minipage}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.