Skip to main content
18 votes

How can I typeset Julia code with the listings package?

For those of you coming from google and having found this page: Inspired by Jubobs three year old post I have recently created a julia language definition for the listings package that tries to ...
wg030's user avatar
  • 181
12 votes

Octave to LaTeX

Nowadays the latex function is available on Octave-Forge in the symbolic package. >> pkg install -forge symbolic >> pkg load symbolic >> a = eye(3); >> latex(sym(a)) \left[\...
Klaas van Aarsen's user avatar
11 votes

Helvetica-font-not-embedded

The problem may not be the Matlab code listings, but the figures from Matlab (and exported in EPS format) that you may be included in your document. When Matlab generate the EPS file, it does not ...
Sergio Llorente's user avatar
9 votes
Accepted

matlab2tikz, label on right side of colorbar

Add \pgfplotsset{compat=newest} to the preamble. \documentclass[tikz,margin=.5cm]{standalone} \usepackage[utf8]{inputenc} \usepackage{pgfplots} \usepackage[T1]{fontenc} \usepackage{siunitx} \...
jak123's user avatar
  • 4,272
9 votes

How can I insert a Matlab code in Lyx easily

I'd recommend using the matlab-prettifier package (see https://tex.stackexchange.com/a/158816/586), which is really just provides a style for the listings package. This will give you good highlighting ...
Torbjørn T.'s user avatar
8 votes

How to highlight a portion of Matlab Code

Here is a method which uses fbox. You simply add this command around the line of code you want to highlight and it will draw a box around it. However, I've actually used a modified version called ...
Milo's user avatar
  • 9,490
7 votes
Accepted

Pgfplots and MATLAB provide different results

Matlab's sin and cos assume radians as input, while pgf's sin and cos assume degrees. For pgfplots you can add trig format=rad to the \addplot options to get the same behaviour as Matlab, then domain=...
Torbjørn T.'s user avatar
7 votes

How to highlight a portion of Matlab Code

This question is relatively close to \fbox inside listings I merely used Martin Scharrer's answer and adapted it for the box coulouring with is other answer about \fcolorbox{<frame color>}{<...
BambOo's user avatar
  • 8,841
6 votes

Intersecting planes not shown correctly with TikZ

There are several other questions on this issue, for instance: Viviani's curve Plane and cone Plane and parabola Plane and some more complex surface As pointed out by Matthew Leingang, this is due ...
iavr's user avatar
  • 231
6 votes

3-dimensional histogram in pgfplots

Despite the many solutions and this being an old post, the initial problem/question, i.e. I have a MATLAB 3D histogram and want to put it in a nice tikz environment, is not solved. This is maybe ...
Pol del Aguila Pla's user avatar
6 votes
Accepted

Multiline Matlab comments in package Listings

My recommendation would be to use the package matlab-prettifier, which is based on listings but provides enhanced features for MATLAB code above and beyond those provided by listings' Matlab language ...
Paul Gessler's user avatar
  • 29.8k
6 votes

Tikz external files and pdf

You can process your tikzpictures as standalone documents and then include them as pictures. E.g., the file myplot.tex might contain \documentclass[border=0.1cm]{standalone} \usepackage{pgfplots} \...
gernot's user avatar
  • 49.9k
6 votes
Accepted

Listings color context sensitive keywords (Matlab)

Use matlab-prettifier package. \documentclass{scrreprt} %\usepackage{listings} \usepackage[numbered,framed]{matlab-prettifier} \usepackage{filecontents} \begin{filecontents*}{foo.m} for i=1:3 x(i)=...
nidhin's user avatar
  • 7,952
4 votes

Best plotting software with latex integration

Nico Schlömer has created packages to generate pgfplots code from both Matlab and matplotlib plots. I don't know if they handle ternary plots though. matlab2tikz on FileExchange (See GitHub for ...
Torbjørn T.'s user avatar
4 votes
Accepted

Move listing numbers outside of framed box in Matlab Prettifier

If you just want to move the numbers, a quick hack could be to use numbersep=25pt or similar. However this will not change the margins around the code block, they will still be different then in the ...
samcarter_is_at_topanswers.xyz's user avatar
4 votes
Accepted

MATLAB Command Window Output

You pretty much have already outlined the work flow. I am assuming you mean the output that appears in the command window. Get MATLAB to write to a text file, see e.g. this function Then, include ...
Dohn Joe's user avatar
  • 1,922
4 votes
Accepted

How to produce this Matlab social network graph from an adjacency matrix in Tikz

A bit crude, but sort of works OK and requires lualatex. A simple parser (which just matches on non-whitespace) plus a graph drawing macro. \RequirePackage{luatex85} \documentclass[tikz,border=5]{...
Mark Wibrow's user avatar
  • 70.5k
4 votes

Is there a way to converting matlab codes to latex?

The Matlab function latex converts symbolic functions to LaTeX code (see https://nl.mathworks.com/help/symbolic/latex.html). For your example, latex(Dx) returns \sqrt{\left|{x - \overline{x}}\right|...
Marijn's user avatar
  • 38.6k
4 votes
Accepted

How do I stop matlab-prettifier thinking print strings are comments?

You can use single quotes instead of double quotes to wrap the string Or else you can define some escape character and put '%' inside the escape characters. Here is a MWE. \documentclass{article} \...
nidhin's user avatar
  • 7,952
4 votes
Accepted

How to draw the figure using pgf-tikz plot or Matlab?

EDIT: a complete edition of my previous post to provide a complete and more structured example, using \foreach to create automated semi circles and all. Now you just have to choose your radiuses into ...
SebGlav's user avatar
  • 19.3k
3 votes

pgfplots and matlab time format

This might well be possible with pgfplots, but it's likely easier to make a new time vector in Matlab that contains the number of seconds from time zero. E.g. in Matlab do t2 = (time-time(1))*86400;, ...
Torbjørn T.'s user avatar
3 votes

Matlab2tikz problem with contourf

As mentioned in the comments, the underlying problem is a bug in matlab2tikz. However, pgfplots 1.14 (release date august 2016) supports filled contour plots out of the box and without 3rd party ...
Christian Feuersänger's user avatar
3 votes

Matrix array overflow

I suggest you acquaint yourself with the pmatrix and align* environments. In the code below, I use \xi rather than # to denote the generic placeholder variable. \documentclass{article} \usepackage{...
Mico's user avatar
  • 513k
3 votes
Accepted

Converting Matlab arrays to LaTeX compatible Code

I don't know of a way to solve 1, Matlab knows how to write to latex, but it is not a typesetting software. However, 2 is possible and quite easy. You could use latexTable to convert your data to a ...
Elad Den's user avatar
  • 3,961
3 votes

How to convert a matlab figure to a latex code? (not to a graphic)

It is highly recommended to use matlab2tikz for this task. You need to download the package and after plotting your figure in Matlab, you should run the matlab2tikz.m function by: matlab2tikz('...
Majid Abdolshah's user avatar
3 votes

How to use \psfrag with Simulink?

This is just a long comment about doing the drawing in tikz instead. Here are some starting points given without comments, most is explained in the tikz manual, plus there are loads and loads of tikz ...
daleif's user avatar
  • 55.2k
3 votes

Drawing spherical harmonic density plots on the surface of a sphere in tikz/pgfplots

Here's a solution in pgfplots (a little weirdness in the coordinate names...): \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \...
John's user avatar
  • 2,400
3 votes

Drawing spherical harmonic density plots on the surface of a sphere in tikz/pgfplots

I could not replicate @Mark solution in Python 3 due to the missing "basemap" in the current Matplotlib module. I finally found a neat solution which outputs 3 types of plots Please check the Python ...
Stefano's user avatar
  • 131

Only top scored, non community-wiki answers of a minimum length are eligible