Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The algorithmic sample code that I am using is something like this:

‎\begin{algorithm}[h]‎  
\caption{Caption Here‎.} \label{alg:Name}  ‎‎   
\begin{algorithmic}[1]‎  
‎\REQUIRE‎  
‎\ENSURE‎  
  ‎\STATE‎  
  ‎\STATE‎  
  ‎\STATE‎     
‎\end{algorithmic}     ‎
‎\end{algorithm}‎  

How can I customize the algorithmic output? for example, when I just entered the \REQUIRE it give me the Setup keyword. BTW, I don't want the numbering along each line, may be I just should not use this package at all :D.

I tried to bypass using such package with some \hrule and \rule defined above and below the text like this:

\rule{\textwidth}{‎2‎pt}  
Some text goes here for cation of the algorithm  
\rule{\textwidth}{‎2‎pt}   

But the text and everything in between goes to the outside of page margin. I just used the code

\vspace{2pt}‎‎‎‎‎‎  
\hrule‎  
‎\vspace{2pt}         

‎‎‎‎‎ instead of the second \rule but still not satisfied with the output, esp. the thickness of the \hrule.

alt text

Please ignore the Persian writings, I want the headline of my algorithm like that without using algorithmic, or using algorithmic package and customized texts for '\ENSURE' and '\REQUIRE'.

Edit (New Question): How can I have the same output using ordinary lines? In other words, how can I define the thickness of two consecutive lines such that the text in-between does not fall outside of the page margin?

share|improve this question
    
I'm not sure what your question is. I guess you want to use rules in some way that is similar in appearance to algorithmic but vastly different in function. You should describe your end goal. –  TH. Dec 4 '10 at 9:32
    
The first question is answered, but it seems that it could be easier to get the same output if any body can answer the second question. –  Yasser Sobhdel Dec 4 '10 at 12:38
add comment

2 Answers

up vote 0 down vote accepted

The Answer to the second question can be found at:
latex-Community

I copy and paste the answer:

    \documentclass{article}
      \newenvironment{question}{\noindent\rule{\textwidth}{1mm}\begin{list}{*}{}\item}{\end{list}}

      \newenvironment{questions}{}{\rule{\textwidth}{1mm}}

\begin{document}
Hello world
  \begin{questions}
     \begin{question}Item one\end{question}
     \begin{question}Item two\end{question}
     \begin{question}Item three\end{question}
  \end{questions}

\end{document}
share|improve this answer
add comment

The (redefinable) definitions of the algorithms package are listed on p. 13 of the documentation. Example:

\newcommand{\algorithmicrequire}{\textbf{Require:}}

If you want to change the effects of \REQUIRE to, say, Whatever: (typeset in italic), add the following to the preamble of your document:

\renewcommand{\algorithmicrequire}{\textit{Whatever:}}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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