Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In the answer to Bold face formatting for vectors instead of overarrows like latex \mathbf{}? was a nice method of specifying the visual display for a variable, so that I can do something like the following to generate display output for vectors in the way that I want it:

Clear[vecX]
Format[boldVector[v_]] := Style[HoldForm[v], FontFamily -> "Arial Black"]
vecX := boldVector[x]
Abs[vecX - vecX'] // TraditionalForm

Is there a way to specify how text in copy-as Latex should appear? For example, if I could do copy-as latex and have vecX above show up as \vecX, then I can have my latex macros deal with the formatting in that context:

\newcommand{\vecX}[0]{\mathbf{x}}
share|improve this question

1 Answer 1

I don't know of a way to do this automatically on Copy as LaTeX. I also do not know enough about LaTeX to know the right way to make changes.

I should point out that vecX no longer appears in the output of Abs[vecX - vecX'] // TraditionalForm therefore you must base your output on boldVector[x] and not vecX, unless you want to work with a held expression, which I imagine you do not.

The best I can recommend is using your own convert-to-LaTeX function something like this:

myTeX =
 StringReplace[
   ToString @ TeXForm[# /. boldVector -> bvTeX], 
   "text{bvTeX}" :> "EXAMPLE"
 ] &;

Abs[vecX - vecX'] // myTeX
\left|\EXAMPLE(x)-\EXAMPLE(x)'\right|

I am sure this is gibberish. I simply want to show how this may be approached.

share|improve this answer
    
I wonder if TeXForm can be extended (maybe with Format, which is assignable) ... –  Szabolcs Feb 24 '12 at 22:02
    
@Szabolcs I wonder too, because I don't know how. –  Mr.Wizard Feb 24 '12 at 22:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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