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:

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:


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 =
   ToString @ TeXForm[# /. boldVector -> bvTeX], 
   "text{bvTeX}" :> "EXAMPLE"
 ] &;

Abs[vecX - vecX'] // myTeX

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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