0

The photo is from Prof Alfredo Canziani from NYU, who manage to create presentation with formulas which parameters using different colour regarding to a same formula.

I wonder is there any editors or tricks in Latex to achieve this especially for blackground presentation.

Link of reference to Professor Alfredo's photo

What I have tried?

I have tried to use draw.io for this code

$$x \text { in }\left(Z_{p}\right)^{*} \text { is a Q.R. } \Leftrightarrow x^{(p-1) / 2}=1 \text { in } Z_{p}$$

enter image description here
The Latex become uncompilable after only assign colors to a certain parameters in the formula

3
  • 1
    What you try so far? At least provide a code of equations ...
    – Zarko
    Feb 9, 2022 at 13:20
  • I have added what I have tried, and its code, thanks for advice 👍
    – Sheldon
    Feb 9, 2022 at 13:43
  • Based on the other pictures posted, I think the professor was using manim to generate these LaTeX output that can be manipulated into videos and animations. May 23 at 18:55

2 Answers 2

1

hm, it may serve as starting point:

\documentclass[border=3.141592,varwidth]{standalone}
\usepackage{xcolor}
\usepackage{amsmath}

\begin{document}
\[
{\color{orange}L}
    \left[ 
{\color{orange}L}({\color{pink}x},{\color{cyan}\mathcal{Y}}),{\color{cyan}y}
    \right]
\]
\end{document}

enter image description here

Addendum: You should use editor by which is the most familiar. Some of them enable to define shortcuts. However on the LaTeX side you can define abbreviations for colored variables. For example, for above MWE is sufficient to define five of them:

\documentclass[border=3.141592,varwidth]{standalone}
\usepackage{xcolor}
\usepackage{amsmath}
    \newcommand\cF{{\color{orange}F}}
    \newcommand\cL{{\color{orange}L}}
    \newcommand\cx{{\color{pink}x}}
    \newcommand\cy{{\color{cyan}y}}
    \newcommand\cmY{{\color{cyan}\mathcal{Y}}}

\begin{document}
\[
\cL
    \left[
\cF(\cx,\cmY),\cy
    \right]
\]
\end{document}

Result of compilation is the same as before, but code is significant shorter. Since the all possible colored variables are unknown to us, is hard to say if this approach is suitable.

2
  • Thanks for the answer, is there any editor do you recommend to assign colors, or we need memorise the grammar? and is there any way to assign main Latex symnbol to white in a given black background environment?
    – Sheldon
    Feb 9, 2022 at 13:46
  • @Sheldon, you can define new commands as abbreviations for colored variables. See addendum to answer.
    – Zarko
    Feb 9, 2022 at 16:12
1

Partial solution:

unicode-math package calls fontspec package, which has a [Color=...] option, at font-level; different colors can be applied to different alphabet ranges.

colours

MWE

\documentclass[border=3.141592,varwidth]{standalone}
\usepackage{xcolor}
\usepackage{unicode-math}

\pagecolor{black}
\setmathfont{TexGyreTermesMath}[Colour=white]
\setmathfont{TexGyreTermesMath}[range=it/{latin},Colour=cyan]
\setmathfont{TexGyreTermesMath}[range=it/{Latin},Colour=pink]
\setmathfont{TexGyreTermesMath}[range={"0079,"1D466},Colour=brown]%y
\setmathfont{TexGyreTermesMath}[range=cal,Colour=yellow]

\begin{document}
\[
L
    \left[ 
L(x,\mathcal{Y}),y
    \right]
\]
\end{document}

In the OP image, the 𝑦 looks hand-coloured (otherwise 𝑦' would be the same colour, not white). Which means 𝑥 must be hand-coloured too.

4
  • Thanks for the answer, is there any editors do you recommend to make it convenient to assign colors to symbols instead of type it by ourselves, or we need memorise the grammar? and is there any way to assign main Latex symnbol to white in a given black background environmen
    – Sheldon
    Feb 9, 2022 at 15:29
  • @Sheldon I don't understand: do you want the editor to produce the latex code that will make a coloured pdf?
    – Cicada
    Feb 10, 2022 at 4:44
  • I am doing presentation with black background which will be good if I can assign the formula parameters in different colors
    – Sheldon
    Feb 10, 2022 at 6:47
  • @Sheldon Please add a small example of what you have tried so far, beginning with \documentclass and ending with \end{document}. This will help people help you. In particular, do you want the y in (x,y) and (y,x) to be the same colour (because math alphabet), or different colours (because of parameter position)? The colours in the original image are based on math alphabet, not parameter.
    – Cicada
    Feb 10, 2022 at 9:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .