5

I've exported a Maple worksheet to LaTeX. The main problem is the Maple input is too long for one line, how do I put in line breaks?

This is the code I want to fix,

\begin{mapleinput}
\mapleinline{active}{1d}{eq1 := diff(theta[1](t), `$`(t, 2))+(1+Delta)*sin(theta[1](t))+ mu*((theta[1](t)/theta[0])\symbol{94}2-1)*(diff(theta[1](t), t))-beta*cos(theta[1](t))*(diff(sin(theta[1](t))+sin(theta[2](t)), `$`(t, 2))) = 0;}{}
\end{mapleinput}

Currently it does this.enter image description here You can see how it needs a line break.

rossi_182
  • 145
  • 2
  • 8

1 Answers1

4

You can define

\newcommand{\maplebreak}{\hfill\break}

and place \maplebreak at appropriate spots in the line.

I also found better to use a smaller font size, as the lines are too filled.

\documentclass{article}
\usepackage[noplots]{maplestd2e}
\usepackage{etoolbox}
\pretocmd\mapleinput{\par\small}{}{} % print the environment at a smaller size
\newcommand\maplebreak{\hfill\break} % where to break lines

\begin{document}
\begin{mapleinput}
\mapleinline{active}{1d}{eq1 := diff(theta[1](t), `$`(t, 2))+(1+Delta)*sin(theta[1](t))+\maplebreak mu*((theta[1](t)/theta[0])\symbol{94}2-1)*(diff(theta[1](t), t))-\maplebreak beta*cos(theta[1](t))*(diff(sin(theta[1](t))+sin(theta[2](t)),\maplebreak `$`(t, 2))) = 0;}{}
\end{mapleinput}
\end{document}

enter image description here

egreg
  • 1,121,712