I have some formatted long text files looking like this:
f=50 k_max=420
Iteration Func-count min f(x) Procedure
0 1 7.07212e-09
1 2 7.07212e-09 initial simplex
2 4 7.06369e-09 reflect
3 6 7.06369e-09 contract outside
4 8 7.06369e-09 contract inside
5 10 7.06367e-09 contract inside
Exiting: Maximum number of function evaluations has been exceeded
- increase MaxFunEvals option.
Current function value: 0.000000
m=3.775
f=100 k_max=1009
Iteration Func-count min f(x) Procedure
0 1 1.89961e-10
1 2 1.89961e-10 initial simplex
2 4 1.33983e-10 expand
3 6 8.33243e-11 expand
4 8 7.98592e-11 contract outside
5 10 7.98592e-11 contract inside
Exiting: Maximum number of function evaluations has been exceeded
- increase MaxFunEvals option.
Current function value: 0.000000
These files are the command line of MATLAB
which are saved using diary
command.
Is there a way to import the source file and typeset it beautifully in LaTeX
? I love to use minted
package or something comparable with colors if possible here.
Best Answer
With the
minted
package, you can useHere's an example file
code.tex
using your sample file and saving it asMat1.m
:The output, after processing with
pdflatex --shell-escape code.tex
:With the
listings
package, you can useA simple example, again with the previous settings
The output: