Text FormattingCopying code to Mathematica

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Copying code to Mathematica

Post by svend_tveskaeg »

Hi all.

Consider the following MWE:

Code: Select all

\documentclass{article}

\usepackage[danish]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{xcolor}

\newcommand{\konst}[1]{\textcolor{blue}{#1}}
\newcommand{\vari}[1]{\textcolor{teal}{#1}}

\begin{document}

\begin{align*}
  &\texttt{Table[FullSimplify[\{Cos[1/\vari{n}*Pi]/(Cos[1/\vari{n}*Pi]+1)*\konst{a},}\\
  &\hphantom{{}\texttt{Tab}}\texttt{\vari{n}*Sin[(\vari{n}-2)/\vari{n}*Pi]/(8*(Cos[1/\vari{n}*Pi]+1)\^{}2)*\konst{a}\^{}2\}], \{\vari{n}, 3, 5\}]}
\end{align*}

\end{document}
The output I get when the above MWE is compiled is almost as I want it, but the caret symbol (^) is not optimum; when the code is copied to Mathematica, I cannot execute it without changing the caret manually.

Is there a way to get the `correct' symbol so that I do not have to change the symbol when the code is copied from the PDF file?

Thank you in advance!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply