# Revision history [back]

This is a minimal working example that makes want you want, using @rburing suggestion:

\documentclass{article}
\usepackage{sagetex}

\begin{document}

\begin{sagesilent}
var("x", latex_name=r"\mathbf{x}")
var("y", latex_name=r"\mathbf{y}")
var("z", latex_name=r"\mathbf{z}")
v = vector([x, y, z])
a = vector([1, -2, -1])
sortie = a*v
\end{sagesilent}

Sortie: $\sage{sortie}$

\end{document}


Please, note that you can replace a.dot_product(v) by a*v. Likewise, for boldface letters, I suggest to use \mathbf. Finally, if you define sortie = str(latex(a.dot_product(v))) inside a sagesilent or sageblock environment, later, a command like \sage{sortie} or $\sage{sortie}$will just print a string, or even produce an error, instead of yielding the expected mathematical expression.

This is a minimal working example that makes want what you want, using @rburing suggestion:

\documentclass{article}
\usepackage{sagetex}

\begin{document}

\begin{sagesilent}
var("x", latex_name=r"\mathbf{x}")
var("y", latex_name=r"\mathbf{y}")
var("z", latex_name=r"\mathbf{z}")
v = vector([x, y, z])
a = vector([1, -2, -1])
sortie = a*v
\end{sagesilent}

Sortie: $\sage{sortie}$

\end{document}


Please, note that you can replace a.dot_product(v) by a*v. Likewise, for boldface letters, I suggest to use \mathbf. Finally, if you define sortie = str(latex(a.dot_product(v))) inside a sagesilent or sageblock environment, later, a command like \sage{sortie} or $\sage{sortie}$will just print a string, or even produce an error, instead of yielding the expected mathematical expression.