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.

I have done everything correctly but my \begin{lstlisting} is overflowing and I did not find any method to stop it. Plz helpenter image description here

\begin{enumerate}[(b)]
 \item To generate a 128bit WEP key. We have added a -w
flag in the switch-case statement and also added a new option in the
array pwgenoptions. After that, we have set the \emph{pw\_length} as 128 for 128bit WEP key. Finally, we have run the make operation again and compiled it successfully. Following the result of our modification:

\begin{lstlisting}
bril@MT2012018:~/Desktop/pwgen-2.06$ ./pwgen -w 5
uGh1r eSh9A ohGh4 seeS5 AhJ2E eiQu6 iY8oe hooP7 AN7ia Ek3ak ohY7n hi5Up Yahc4
ue9Sh du4Nu ohr9I ag7oD Iyou9 Rei2m Aev4v ga8Hu Ait3e Ahph7 Om1ee Phob8 Eo2Oh
io9Ai too2H joh0A ui8Iu foh0R Ze0ai Iw6wu VaJ2x ieM3I ve9aM ohd7A mee4H LueX7
OhV8u Seeh4 ohg1I Mejo1 Ook3V Eel3h ec2Co huiN2 Pie6X Raet6 Akua3 Voh8d aiG4S
ivu5U teeV9 Oop9r Pai9G ox3Ei eiT8x Fei7u Phoi1 Eot6F aer2U Ga1og nai8E wee7U
Eor9A oph1X Ti9ye uoF7w Joo2w cho2I Ool8Z aik8K OoV7V Eet5n AhL7U ooc3U AiSh1
Pie1x wei7X eeSh1 Ai4ae voR1a Yook8 Be9Ie Ahl9N eP1Za Zu5th Id7ai io7Oo She7m
cai1W ivoY8 Quou3 taiT4 Ak2uk poh6Y Eyo2g Eis7d gol0E hu6Qu Xai9u eeZ5E Ugie6
zeo5I al7Ti ia4Ph Quiy2 Orai8 zeiY2 Ie0go Phoo6 oTh9u eWoo7 Eiph3 eed9D Caiv4
eeZ6i Shou0 gae7A uap6R ahM1a oox0E Aen2E lat9H Uj7ei Aik8w Ik1no ohP0f Oosh0
ooP1p Hau3p ooM0p oeK4o Tii1w aoC3d Ogh5E eo3EF vie1Z Hohl5 Cooy2 oD6ju Ahph2
cee8E Kex2a iCh0T Peej2 iiSh6 ith3U bohV8 So9ei Iu1ye aef8E Jue9s uGh9A kui7B
au7Ae Aep8H Ie5ro jai2O ohH0o Ohco6 Quai6 lei1Y oaQu7 ooD8u Do7ie Oos8y Eexe1
Giz4J Eeh4y Aix4x pei1H ESh0i Iel2I aeN5o tahY1 ga8Ae moaC9 ieT6s ooVu4 Vohc2
ahc7H uQu9d Eigh4 xi5Ah Oof4i Yoo7e sohW0 vei8H Ouch2 UCh0v ood9V aV3to ood4S
yu4Oo Eich3 eiG6u oox2A Ohy2j xea6A Ga6Oh zaTh2 aej6I voh5V Ooz8z Zahy1 een1R
eeJ5j uRee8 yia2N Iyub9 xah3P oh4Ai AhT6u OB3fa Ie1ui OoGh2 if7Io eeGo4 Woo4l
sa2Ta looR8 bei1E Vac2v Ooji9 Cah4l UC9ui ieZ1e Eivu5 Naeb6 ooQu9 ohFu1 OoX8i
queB1 jooM5 uF2oo Ra5al coN2a uV3ee if9Ai Wee1W Iek2j tahY9 Miu4i ZuN2i Caez4
Jae2i XieY3 ohj1I IeG2b eeNg5 ish4G Eid4o eoGh2 ui8Ah Ahzi7 Chuc1 Oox4k Nah2u
\end{lstlisting}

  \end{enumerate}
share|improve this question

migrated from stackoverflow.com Jan 14 '13 at 22:12

This question came from our site for professional and enthusiast programmers.

1  
We can't help you without source code. –  Zack Jan 14 '13 at 16:55
    
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Jan 14 '13 at 23:34

2 Answers 2

up vote 1 down vote accepted

Please always give a full MWE. For your problem, use breaklines=true as an option to \begin{lstlisting}:

\documentclass{article}

\usepackage{listings,paralist}


\begin{document}

\begin{enumerate}[(b)]
 \item To generate a 128bit WEP key. We have added a -w
flag in the switch-case statement and also added a new option in the
array pwgenoptions. After that, we have set the \emph{pw\_length} as 128 for 128bit WEP key. Finally, we have run the make operation again and compiled it successfully. Following the result of our modification:

\begin{lstlisting}[frame=single,breaklines=true]
bril@MT2012018:~/Desktop/pwgen-2.06$ ./pwgen -w 5
uGh1r eSh9A ohGh4 seeS5 AhJ2E eiQu6 iY8oe hooP7 AN7ia Ek3ak ohY7n hi5Up Yahc4
ue9Sh du4Nu ohr9I ag7oD Iyou9 Rei2m Aev4v ga8Hu Ait3e Ahph7 Om1ee Phob8 Eo2Oh
io9Ai too2H joh0A ui8Iu foh0R Ze0ai Iw6wu VaJ2x ieM3I ve9aM ohd7A mee4H LueX7
OhV8u Seeh4 ohg1I Mejo1 Ook3V Eel3h ec2Co huiN2 Pie6X Raet6 Akua3 Voh8d aiG4S
ivu5U teeV9 Oop9r Pai9G ox3Ei eiT8x Fei7u Phoi1 Eot6F aer2U Ga1og nai8E wee7U
Eor9A oph1X Ti9ye uoF7w Joo2w cho2I Ool8Z aik8K OoV7V Eet5n AhL7U ooc3U AiSh1
Pie1x wei7X eeSh1 Ai4ae voR1a Yook8 Be9Ie Ahl9N eP1Za Zu5th Id7ai io7Oo She7m
cai1W ivoY8 Quou3 taiT4 Ak2uk poh6Y Eyo2g Eis7d gol0E hu6Qu Xai9u eeZ5E Ugie6
zeo5I al7Ti ia4Ph Quiy2 Orai8 zeiY2 Ie0go Phoo6 oTh9u eWoo7 Eiph3 eed9D Caiv4
eeZ6i Shou0 gae7A uap6R ahM1a oox0E Aen2E lat9H Uj7ei Aik8w Ik1no ohP0f Oosh0
ooP1p Hau3p ooM0p oeK4o Tii1w aoC3d Ogh5E eo3EF vie1Z Hohl5 Cooy2 oD6ju Ahph2
cee8E Kex2a iCh0T Peej2 iiSh6 ith3U bohV8 So9ei Iu1ye aef8E Jue9s uGh9A kui7B
au7Ae Aep8H Ie5ro jai2O ohH0o Ohco6 Quai6 lei1Y oaQu7 ooD8u Do7ie Oos8y Eexe1
Giz4J Eeh4y Aix4x pei1H ESh0i Iel2I aeN5o tahY1 ga8Ae moaC9 ieT6s ooVu4 Vohc2
ahc7H uQu9d Eigh4 xi5Ah Oof4i Yoo7e sohW0 vei8H Ouch2 UCh0v ood9V aV3to ood4S
yu4Oo Eich3 eiG6u oox2A Ohy2j xea6A Ga6Oh zaTh2 aej6I voh5V Ooz8z Zahy1 een1R
eeJ5j uRee8 yia2N Iyub9 xah3P oh4Ai AhT6u OB3fa Ie1ui OoGh2 if7Io eeGo4 Woo4l
sa2Ta looR8 bei1E Vac2v Ooji9 Cah4l UC9ui ieZ1e Eivu5 Naeb6 ooQu9 ohFu1 OoX8i
queB1 jooM5 uF2oo Ra5al coN2a uV3ee if9Ai Wee1W Iek2j tahY9 Miu4i ZuN2i Caez4
Jae2i XieY3 ohj1I IeG2b eeNg5 ish4G Eid4o eoGh2 ui8Ah Ahzi7 Chuc1 Oox4k Nah2u
\end{lstlisting}

  \end{enumerate}

\end{document}

enter image description here

share|improve this answer

From page 33 of the Listings manual you can use the breaklines key. Using your example code I added some packages to get the following MWE

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{listings,enumerate}

\begin{document}
    \begin{enumerate}[(b)]
     \item To generate a 128bit WEP key. We have added a -w
    flag in the switch-case statement and also added a new option in the
    array pwgenoptions. After that, we have set the \emph{pw\_length} as 128 for 128bit WEP key. Finally, we have run the make operation again and compiled it successfully. Following the result of our modification:

    \begin{lstlisting}[breaklines=true]
    bril@MT2012018:~/Desktop/pwgen-2.06$ ./pwgen -w 5
    uGh1r eSh9A ohGh4 seeS5 AhJ2E eiQu6 iY8oe hooP7 AN7ia Ek3ak ohY7n hi5Up Yahc4
    ue9Sh du4Nu ohr9I ag7oD Iyou9 Rei2m Aev4v ga8Hu Ait3e Ahph7 Om1ee Phob8 Eo2Oh
    io9Ai too2H joh0A ui8Iu foh0R Ze0ai Iw6wu VaJ2x ieM3I ve9aM ohd7A mee4H LueX7
    OhV8u Seeh4 ohg1I Mejo1 Ook3V Eel3h ec2Co huiN2 Pie6X Raet6 Akua3 Voh8d aiG4S
    ivu5U teeV9 Oop9r Pai9G ox3Ei eiT8x Fei7u Phoi1 Eot6F aer2U Ga1og nai8E wee7U
    Eor9A oph1X Ti9ye uoF7w Joo2w cho2I Ool8Z aik8K OoV7V Eet5n AhL7U ooc3U AiSh1
    Pie1x wei7X eeSh1 Ai4ae voR1a Yook8 Be9Ie Ahl9N eP1Za Zu5th Id7ai io7Oo She7m
    cai1W ivoY8 Quou3 taiT4 Ak2uk poh6Y Eyo2g Eis7d gol0E hu6Qu Xai9u eeZ5E Ugie6
    zeo5I al7Ti ia4Ph Quiy2 Orai8 zeiY2 Ie0go Phoo6 oTh9u eWoo7 Eiph3 eed9D Caiv4
    eeZ6i Shou0 gae7A uap6R ahM1a oox0E Aen2E lat9H Uj7ei Aik8w Ik1no ohP0f Oosh0
    ooP1p Hau3p ooM0p oeK4o Tii1w aoC3d Ogh5E eo3EF vie1Z Hohl5 Cooy2 oD6ju Ahph2
    cee8E Kex2a iCh0T Peej2 iiSh6 ith3U bohV8 So9ei Iu1ye aef8E Jue9s uGh9A kui7B
    au7Ae Aep8H Ie5ro jai2O ohH0o Ohco6 Quai6 lei1Y oaQu7 ooD8u Do7ie Oos8y Eexe1
    Giz4J Eeh4y Aix4x pei1H ESh0i Iel2I aeN5o tahY1 ga8Ae moaC9 ieT6s ooVu4 Vohc2
    ahc7H uQu9d Eigh4 xi5Ah Oof4i Yoo7e sohW0 vei8H Ouch2 UCh0v ood9V aV3to ood4S
    yu4Oo Eich3 eiG6u oox2A Ohy2j xea6A Ga6Oh zaTh2 aej6I voh5V Ooz8z Zahy1 een1R
    eeJ5j uRee8 yia2N Iyub9 xah3P oh4Ai AhT6u OB3fa Ie1ui OoGh2 if7Io eeGo4 Woo4l
    sa2Ta looR8 bei1E Vac2v Ooji9 Cah4l UC9ui ieZ1e Eivu5 Naeb6 ooQu9 ohFu1 OoX8i
    queB1 jooM5 uF2oo Ra5al coN2a uV3ee if9Ai Wee1W Iek2j tahY9 Miu4i ZuN2i Caez4
    Jae2i XieY3 ohj1I IeG2b eeNg5 ish4G Eid4o eoGh2 ui8Ah Ahzi7 Chuc1 Oox4k Nah2u
    \end{lstlisting}
  \end{enumerate}
\end{document}

Which you could also extend with prebreak=<tokens> and postbreak=<tokens> to add characters at the end of the line (before line break) and at the beginning of the next. This compiles to (leaving out your styling, because i don't have that) result

share|improve this answer

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.