0
% arara: lualatex: { synctex: yes, shell: yes } 
% arara: biber
% arara: lualatex: { synctex: yes, shell: yes } if changed('bbl')
% arara: lualatex: { synctex: yes, shell: yes } if changed('toc')
\documentclass[a4paper,12pt]{scrartcl}

\usepackage{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{listingsutf8,amssymb}
\usepackage{xcolor}
\usepackage{matlab-prettifier}
\usepackage{scrhack}

\lstset{literate ={↑}{$\uparrow$}1}

\begin{document}

\section{Introduction to MATLAB}

\subsection*{Exercise 1.3}
\begin{lstlisting}[style=Matlab-editor]
>> z = 25-(100-7exp(5+cos(pi/3))
 z = 25-(100-7exp(5+cos(pi/3))
             ↑
Error: Invalid use of operator.

Did you mean: z = 25-(100-7*exp  (5+cos(pi/3)))
>> z = 25-(100-7*exp  (5+cos(pi/3)))

z =

   1.6378e+03
\end{lstlisting}

\end{document}

I've tried following this answer and still my upwards arrow is invisible:

Screenshot of the listing in PDF form

Edit

After changing my first two usepackage lines to:

\usepackage{fontspec}
\usepackage[utf8]{inputenc}

And removing the lstset, all Unicode characters now properly show, but the arrow is not put where it should be (it is at the end of the previous line, not pointing from the d to the 7):

Screenshot

2
  • 1
    I just copied your code into Overleaf and it worked (I've got an upwards arrow pointing from the "d" of invalid to the 7 above)... Commented Apr 10, 2020 at 8:36
  • I'm using TeXWorks on Windows with MiKTeX and compiling with arara via LuaHBLaTeX
    – Aly
    Commented Apr 10, 2020 at 23:24

0

Browse other questions tagged .