I use a minimal code example with Julia





# Polynomial Features ϕ = [1,x,x²,x³,...,xⁿ]' of Degree n
ϕ(x,n) = (x' .^ collect(range(0, stop=n, length=(n+1))))';

function polynomial_regression(x,y,xq,n)   
   𝚽  = ϕ(x,n); # Training data

   # Linear Regression 
   θ = inv(𝚽'*𝚽)*𝚽'*y;  

   # Predict Query Data
   yp = ϕ(xq,n)*θ;


I get a

./Example-minimal.out.pyg:2: Package inputenc Error:    Unicode character Ï (U+3D5)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.

l.2 ...1,x,x²,x³,...,xâ¿]\PYGZsq{} of Degree n}
  • Welcome. Did you do a search in the forum to "Package inputenc Error: Unicode character"? There are numerous similar problems, probably they will give a solution. – albert Nov 6 '18 at 11:02
  • 2
    Hm. You should perhaps consider to use xelatex or lualatex if you want to use so much unicode. And you probably will have to use some other font inside the listing, see e.g. tex.stackexchange.com/a/100621/2388. – Ulrike Fischer Nov 6 '18 at 11:08

In the Legacy Toolchain

Load the legacy text encodings you’ll need with fontenc, then fill in any missing characters with \newunicodechar.

\usepackage[LGR, T1]{fontenc}
\usepackage[utf8]{inputenc} % The default since 2018
\usepackage{lmodern, newunicodechar}
% To fit within the width allowed on TeX.SX:

% ϕ(U+03D5) is the math symbol with a vertical stroke.  It is in OML.
% 𝚽(U+1D6DF) is present in certain font packages, but there is no typewriter
% bold upright font face of either cmtt or lmtt in LGR or OT1.  Should fall
% back to normal weight.
% Should be the mathematical symbol, rather than the Greek lowercase letter:


The following is cropped for display here:

Julia source code

Unfortunately, the alphabeta and babel packages appear to be incompatible with minted, but you can load textgreek as an alternative to redefining \texttheta, etc.

You’ll likely want to be more consistent than I was about whether you use upright or slanted Greek letters. The default font family doesn’t have a bold typewriter Φ, so in this sample it fell back to regular weight. You can substitute the glyph you prefer from any Type 1 font of your choice. The Φ glyph is in the legacy LGR, OML and OT1 encodings, and in several fonts with non-standard encodings as well.

In the Modern Toolchain

Although you tagged the question with pdftex, the easiest and best solution by far is to load fontspec and a monospaced font that contains all the symbols you use, such as the one in your editor. Then compile with LuaLaTeX or XeLaTeX.

The following patches the CM Unicode fonts with a few Greek math symbols from Latin Modern Math:

% To fit within the width allowed on TeX.SX:

\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{CMU Serif}[Scale = 1.0]
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\setmathfont{Latin Modern Math}

% Although you could select a font that contains all the symbols your
% source uses, I’ll fall back here on redefining the handful that are
% missing.

\newfontface\mathsymbolfont{Latin Modern Math}


CMU Typewriter Text sample

This has a number of advantages, including that you can copy the source from the PDF and paste into an editor.

An alternative to ɸ would be to redefine ϕ (U+03D5, Greek Phi Symbol) as ɸ (U+0278, Latin Small Letter Phi), which CMU Typewriter Text does contain. Or you can instead make other Greek letters, such as θ, slanted for consistency.


The best solution that I could determine was manually defining all missing characters by


until it shows no more errors. If anyone knows a more elegant approach, please add it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.