LaTeX \newcommand on Physics Forum post

Hello, this is my first question on Physics Forums and is a question on how to ask questions.
I have been using LaTex for a while already.

I wanted to post a thread about classical field theory. I tried to use \newcommand just to make easier the typing of expressions such as:

[tex]
\frac{\partial}{\partial \left( \frac{\partial\phi}{\partial x^\mu} \right)}
[/tex]
I haven't been able to do so and I cannot find anything on \newcommand in the main How to Latex on PF guides.

I would like to implement my command as:
Code:
\newcommand{\parcial}[2]{\frac{\partial{#1}}{\partial{#2}}}
Any ideas on how to do that? Probably this has been answered before?
Is there any systematic way of instead uploading a .tex file with all the prompt and packages?
 

Orodruin

Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
2018 Award
15,841
5,828
$$
\newcommand{\dd}[2]{\frac{\partial #1}{\partial #2}}
\dd{f}{x}
$$
Seems to be working to me.
 
Already solved! After some trial and error I managed to put a prompt of redefined commands that seem to be working.
Besides that, is it possible to simply upload .tex files somehow? Because I want to upload part of an article I have been working on and replacing $$ and \begin{equation} to [tex] ... [/tex] is a bit tedious (but not too much though).
 

S.G. Janssens

Science Advisor
Education Advisor
829
611
Besides that, is it possible to simply upload .tex files somehow? Because I want to upload part of an article I have been working on and replacing $$ and \begin{equation} to [tex] ... [/tex] is a bit tedious (but not too much though).
I'm quite sure it is currently not possible to upload ##\LaTeX##-files for verbatim use on the forum, nor when writing an "Insight", for that matter. Both use Mathjax (also see this Insight) which comes with its own set of tags to do the ##\LaTeX##-typesetting.

If you know a language that supports regular expressions (such as Python, or Perl), it is not too hard to write a script that can take a source document and output a text that is ready for pasting into a forum or WordPress post. A while ago I wrote a small script to convert ##\LaTeX##-source into WordPress + QuickLaTeX. It should be easy to adapt to work with Mathjax instead.

However, I would not post large parts of a document on PF, at least not in a single post.
 
  • Like
Reactions: mfb

ChrisVer

Gold Member
3,327
434
why would you want to post the .tex file instead of the produced pdf (let's say)?
 

S.G. Janssens

Science Advisor
Education Advisor
829
611
why would you want to post the .tex file instead of the produced pdf (let's say)?
I don't think he wants to post the .tex file.

I think he wondered whether he could upload a file containing standard ##\LaTeX## (with both text and math) and then have it automatically converted to the MathJax syntax used by the forum. (All text-mode ##\LaTeX## commands - such as ordinary enumerations - should then also be converted into forum-compatible form.)
 

vanhees71

Science Advisor
Insights Author
Gold Member
12,931
4,982
In fact that would be a great feature!
 

jack action

Science Advisor
Insights Author
Gold Member
1,807
1,091
It seems that whatever you write in ##\LaTeX## in one set of tags, it is still valid in the others. For example, the previous ##\LaTeX## expression \dd{f}{x} ##\left(\dd{f}{x}\right)## is valid here as it was defined in post #2. But \ddd{f}{x} ##\left(\ddd{f}{x}\right)## is not defined and shows up as an error. It is however defined in this ##hidden\ \LaTeX
\newcommand{\ddd}[2]{\frac{\partial^2 #1}{\partial #2^2}}## (right-click expression and select «Show Math As -> TeX Commands») and now it shows up correctly ##\ddd{f}{x}##.

So just copy your .tex file at the beginning of your first post and it should be valid for your subsequent posts as well. I guess if the thread is spread on multiple pages, the .tex file will have to be rewritten in one early post on each page if needed.
 

OCR

780
614
I guess if the thread is spread on multiple pages...
You might be able to just make a reply in the text box of the original page, then select the text, or click select all... then "cut" and paste the text into the reply box on a different numbered page... ?

The below text actually came from another thread...
A safer saw has my approval.
Here's a screen shot of what I'm trying to say...

Cut and Paste.JPG


Clear as mud, eh ? :oldsmile:
 
Last edited:

Want to reply to this thread?

"\newcommand on Physics Forum post" You must log in or register to reply here.

Related Threads for: \newcommand on Physics Forum post

Replies
6
Views
1K
Replies
5
Views
4K
  • Posted
Replies
2
Views
2K
Replies
1
Views
693
Replies
1
Views
4K
Replies
5
Views
3K
  • Posted
Replies
3
Views
2K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top