Quantcast
Channel: Active questions tagged copy-paste - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 70

Customize copy-text for box

$
0
0

Motivation

My end goal is to include more Mathematica expressions in LaTeX-pdfs that are copy-paste-able back into Mathematica notebooks. For instance, the code

\usepackage{mmacells}...\begin{mmaCell}{Input}  \mmaSub{\(\pmb{\partial}\)}{x}\mmaSup{x}{2}\end{mmaCell}

yields

in1 pdxx^2

but if you copy that and paste it into a Mathematica notebook, it makes

invalid mma code

instead of the 'correct'

valid mma code

This makes sense: the raw copied text is "∂ x x2". Other unicode characters generated by CellToTeX copy like "\[Pi]", one of Mathematica's auto expanding inputs (if you paste that string into a notebook, it'll show as π). There is some raw text that produces the correct Mathematica code, though:

\!\(\*SubscriptBox[\(\[PartialD]\), \(x\)]\*SuperscriptBox[\(x\), \(2\)]\)

Basically, \!\(...\) with the ! says to auto expand, and wrapping things in \(\) and with \* does other parsing stuff. So if that string was to be copied when selecting the stuff in the pdf, it would be pasted beautifully back into a notebook.

Question

Is there a good way or package to specify what is copied for some selected pdf content of some cells? Can I wrap the \begin{mmaCell}...\end{mmaCell} with something like a href{\\!\\(\\*SuperscriptBox...\\)}{...}, but instead of a link, change the copy-paste content? Or do I have to begin spelunking inside the TeXbook, but probably not that -- I might have to spelunk in pdflatex or something else. Correct me if I'm wrong, but the mmacells package is pretty much just styling, and can't help here.


Viewing all articles
Browse latest Browse all 70

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>