1

enter image description here

Please go through code

\begin{align*}
 For(j=0;j\leq n-1;j++)   
 \end{align*}
 \vspace*{0.01cm}
  \\*\hspace*{2.4cm}\{ 
   \begin{align*}
  \hspace*{1.5cm}For(i=0,i\leq n-1;i++)  
  \end{align*}              
  \\*\hspace*{3.2cm}\{ 
 \\*\hspace*{4cm}$b_{j} . a_{i} = A_{j}[i]$;   
  \\*\hspace*{3.1cm} \} 
 \\*\hspace*{2.4cm} \}

After first for loop one empty line is created and for second for loop also.Is there any way to remove those empty lines. And if there is any other code format, i need structure of for loop as shown in figure. please help me in this removing empty line.

  • 2
    Remove \vspace*{0.01cm} \\*, however, from your image can be concluded that you actually write psevdocode. For this is intended package listings (see texdoc.net/texmf-dist/doc/latex/listings/listings.pdf) Welcome to TeX.SE – Zarko Nov 23 '16 at 11:22
  • I have removed \vspace{0.01cm} but still i am getting empty line. can you please post the code where empty line is not created. – Jaswanth Vuggirala Nov 23 '16 at 11:24
  • You need also to remove \\* in the next line ... – Zarko Nov 23 '16 at 11:25
  • 1
    @JaswanthVuggirala, although I strongly recommend that you follow Zarko's suggestions and take a look at listings or minted pacakages. They are meant for this Kind of writing (code writing). minted can even process the sub and superscripts from math (maybe listings can too but I do not know) and they allow line breaks as well. – Guilherme Zanotelli Nov 23 '16 at 11:37
  • @Zarko, Thank you so much. listings did worked for me. – Jaswanth Vuggirala Nov 23 '16 at 13:37

Your Answer

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

Browse other questions tagged or ask your own question.