Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

A long line of my python code isn't displayed well in a beamer slide

I’m facing a complicated issue with the ‘minted’ package, i want to display my python code in beamer , but it occurs that a long line doesn’t fit well as shown in the snippet bellow. I’m asking if i can adjust my latex code so that a long line of my python code return to the line , also if i can adjust the number of lines in a slide from 15 lines – as u can see in the image- to like 10 lines.

Here’s my code :

\documentclass[13pt]{beamer}
\usetheme{Copenhagen}
\usepackage{minted}

\begin{document}
\begin{frame}[fragile,allowframebreaks]
\begin{minted}[linenos]{python}


#paramètres de l'interaction psychologique du piéton avec son entourage (suggerés par Moussaid):
    A=0.5 # permet de considerer le caractere anisotropique du piéton
    B=1   # la portée de l'interaction répulsive


#paramètres de la force de formation des sous-groupes (suggerés par Moussaid):
B1=B2=B3=4 # les amplitudes des forces d'interactions
q1=q2=1    # q1=q2=0 s'il n'y'a pas un sous-groupe à former
ai=0       # décrit l'orientation de la tête du piéton par rapport à la direction de son mouvement
\end{minted}
\end{frame}
\end{document}

which gave me the next snippet:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

I hope if anybody can help me and i will very grateful.

>Solution :

You can use the breaklines option to allow line breaks:

% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass{beamer}
\usetheme{Copenhagen}
\usepackage{minted}

\begin{document}
\begin{frame}[fragile,allowframebreaks]
\begin{minted}[linenos,breaklines]{python}
#paramètres de l'interaction psychologique du piéton avec son entourage (suggerés par Moussaid):
    A=0.5 # permet de considerer le caractere anisotropique du piéton
    B=1   # la portée de l'interaction répulsive


#paramètres de la force de formation des sous-groupes (suggerés par Moussaid):
B1=B2=B3=4 # les amplitudes des forces d'interactions
q1=q2=1    # q1=q2=0 s'il n'y'a pas un sous-groupe à former
ai=0       # décrit l'orientation de la tête du piéton par rapport à la direction de son mouvement
\end{minted}
\end{frame}
\end{document}

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading