Share Latex Code Easily: Tips and Tricks

  • Context: LaTeX 
  • Thread starter Thread starter PainterGuy
  • Start date Start date
  • Tags Tags
    Code Latex
Click For Summary
SUMMARY

This discussion focuses on sharing LaTeX code generated by Scientific Workplace (SW) 5.50 and 6.0 in a forum setting. Users express challenges in converting LaTeX code into a format that is easily shareable and readable by others. The recommended approach includes using Notepad++ to clean up the code by removing unnecessary HTML tags and replacing delimiters. Participants also suggest using online LaTeX editors like Codecogs and highlight the importance of using correct LaTeX syntax, such as replacing \textperiodcentered with \cdot for multiplication.

PREREQUISITES
  • Familiarity with LaTeX syntax and commands
  • Experience using Scientific Workplace 5.50 or 6.0
  • Basic knowledge of HTML formatting
  • Proficiency in using text editors like Notepad++ for code manipulation
NEXT STEPS
  • Learn how to use LaTeX commands from the amsmath package
  • Explore advanced features of Scientific Workplace 6.0
  • Research online LaTeX editors and viewers for better sharing options
  • Practice converting LaTeX code to forum-compatible formats
USEFUL FOR

Mathematicians, engineers, and academics who frequently use LaTeX for documentation and need to share their work in online forums effectively.

PainterGuy
Messages
938
Reaction score
73
Hi

I use Scientific Workplace to write down math equations and also to create documents involving mathematics and to do calculations. Although most people use it for writing science articles, I've found it extremely helpful for whatever little bit of mathematics I do.

I face a problem when I need to share my work with someone, say, on this forum. Mostly I take a screenshot of my work and share it like this. But I can imagine that it's not easy for a person who is trying to help me to correct any error in my calculations or to point out a certain fragment or equation from the screenshot. What can I do to make it little easier and convenient for others? The software can produce xHTML page too but the forum doesn't support the format. When I try to copy the latex code for the linked screenshot, I get the following which doesn't make much sense and I don't know how to put into proper latex form so it can be made work here.

Code:
038<p type="texpara" tag="Body Text" >$\U{394} P=\frac{8\U{3bc} LQ}{\U{3c0} R\U{2074} }$
   
038<p type="texpara" tag="Body Text" >$\U{394} P$ is the pressure difference between the two ends
   
038<p type="texpara" tag="Body Text" >$L$ is the length of pipe, $1$ $km$
   
038<p type="texpara" tag="Body Text" >$\U{3bc} $ is the dynamic viscosity,  $8.90\times 10^{-4}$ $Pa$\textperiodcentered $s$
   
038<p type="texpara" tag="Body Text" >$Q$ is the volumetric flow rate, $2m^{3}/s$
   
038<p type="texpara" tag="Body Text" >$R$ is the pipe radius, $0.2m$
   
038<p type="texpara" tag="Body Text" >
   
038<p type="texpara" tag="Body Text" >$\U{394} P=\frac{8\U{3bc} LQ}{\U{3c0} R\U{2074} }=\frac{8\ast 8.90\times 10^{-4}\ast 997.6\ast 2}{\U{3c0} \ast 0.2^{4}}=\allowbreak \frac{8878.\,\allowbreak 6}{\U{3c0} }=2826$ $Pa$

Please let me know that how I can make it little easier for others. Thank you.
 
Physics news on Phys.org
You could simply write it out like this:

##\Delta P=\dfrac{8\mu LQ}{\pi R^4 }##

##\Delta P## is the pressure difference between the two ends

##L## is the length of pipe, ##1\text{ km}##

##\mu ## is the dynamic viscosity, ##8.90\times 10^{-4}\text{ Pa}\cdot\text{s}##

##Q## is the volumetric flow rate, ##2\,\dfrac{\text{m}^3}{\text{s}}##

##R## is the pipe radius, ##0.2\text{ m}##



##\Delta P=\dfrac{8\mu LQ}{\pi R^4 }=\dfrac{8\cdot 8.90\times 10^{-4}\cdot 997.6\cdot 2}{\pi \cdot 0.2^{4}}=\dfrac{8878.6}{\pi}=2826 \text{ Pa}##

Quote my post to see the difference between what you have in Scientific Workplace and what I posted above.
 
  • Like
Likes   Reactions: PainterGuy
MarkFL said:
You could simply write it out like this:

##\Delta P=\dfrac{8\mu LQ}{\pi R^4 }##

##\Delta P## is the pressure difference between the two ends

##L## is the length of pipe, ##1\text{ km}##

##\mu ## is the dynamic viscosity, ##8.90\times 10^{-4}\text{ Pa}\cdot\text{s}##

##Q## is the volumetric flow rate, ##2\,\dfrac{\text{m}^3}{\text{s}}##

##R## is the pipe radius, ##0.2\text{ m}##



##\Delta P=\dfrac{8\mu LQ}{\pi R^4 }=\dfrac{8\cdot 8.90\times 10^{-4}\cdot 997.6\cdot 2}{\pi \cdot 0.2^{4}}=\dfrac{8878.6}{\pi}=2826 \text{ Pa}##

Quote my post to see the difference between what you have in Scientific Workplace and what I posted above.

Thank you.

I believe that you typed it out again here. The problem is that it would just require me re-type everything and it would leave Scientific Workplace (SW) useless as far as just writing down a document goes. Do you see any easy way to fix my SW code so that I could just share it? Thanks.
 
Right click on equation, select "show math as" and then choose tex commands.
 
  • Like
Likes   Reactions: PainterGuy
PainterGuy said:
Thank you.

I believe that you typed it out again here. The problem is that it would just require me re-type everything and it would leave Scientific Workplace (SW) useless as far as just writing down a document goes. Do you see any easy way to fix my SW code so that I could just share it? Thanks.

I copy/pasted what you included in the CODE box into a text editor (Notepad++), and then used the replace function to remove the leading "038" and the opening HTML paragraph tag. Then I replaced the \U{xxx} characters with the equivalent ##\LaTeX## symbols, and a few other minor adjustments.

I think the main difference is that in your work environment dollar signs are used as delimiters, whereas here double pound signs are used. You may get away with simply replacing those, as I suspect the other things were a result of you copying HTML rather than your raw text.
 
  • Like
Likes   Reactions: PainterGuy
MarkFL said:
I think the main difference is that in your work environment dollar signs are used as delimiters, whereas here double pound signs are used.
Double pound for inline, double dollar sigh for new line.
 
  • Like
Likes   Reactions: MarkFL
Greg Bernhardt said:
Double pound for inline, double dollar sigh for new line.

Ah...I noticed the TEX tags also serve as display type delimiters. Double dollar is easier...thanks!
 
MarkFL said:
Ah...I noticed the TEX tags also serve as display type delimiters. Double dollar is easier...thanks!
Right tex and itex
 
  • #10
Thank you, everyone.

I use Scientific Workplace 5.50 but just downloaded SW 6 to experiment with it. The latex code below was generated by SW 6 and I just replaced "$" with ""##" using Notepad++. It looks a little better compared to the previous one. I believe that it'd make a little easier for others.

Do you know of any free online latex viewer and editor? I found this https://latexbase.com/ which isn't really working for me. Thanks.

##\Delta P =\frac{8 \mu L Q}{\pi R {\small\fbox{2074}} }##

##\Delta P## is the pressure difference between the two ends

##L## is the length of pipe, ##1## ##k m##

##\mu ## is the dynamic viscosity, ##8.90 \times 10^{ -4}## ##P a##{\textperiodcentered}##s##

##Q## is the volumetric flow rate, ##2 m^{3}/s##

##R## is the pipe radius, ##0.2 m##

##\Delta P =\frac{8 \mu L Q}{\pi R {\small\fbox{2074}} } =\frac{8 \ast 8.90 \times 10^{ -4} \ast 997.6 \ast 2}{\pi \ast 0.2^{4}} =\frac{8878.\,6}{\pi } =2826## ##P a##
 
  • #12
PainterGuy said:
The latex code below was generated by SW 6 and I just replaced "$" with ""##" using Notepad++. It looks a little better compared to the previous one. I believe that it'd make a little easier for others.
The conversion to TEX doesn’t seem like it will help you much since it’s introducing several problems itself. Unless you can copy and modify the raw code for the original you are working on, posting a picture like you first mentioned is probably your best bet.
 
  • Like
Likes   Reactions: PainterGuy
  • #13
PainterGuy said:
Thank you, everyone.

I use Scientific Workplace 5.50 but just downloaded SW 6 to experiment with it. The latex code below was generated by SW 6 and I just replaced "$" with ""##" using Notepad++. It looks a little better compared to the previous one. I believe that it'd make a little easier for others.

Do you know of any free online latex viewer and editor? I found this https://latexbase.com/ which isn't really working for me. Thanks.

##\Delta P =\frac{8 \mu L Q}{\pi R {\small\fbox{2074}} }##

##\Delta P## is the pressure difference between the two ends

##L## is the length of pipe, ##1## ##k m##

##\mu ## is the dynamic viscosity, ##8.90 \times 10^{ -4}## ##P a##{\textperiodcentered}##s##

##Q## is the volumetric flow rate, ##2 m^{3}/s##

##R## is the pipe radius, ##0.2 m##

##\Delta P =\frac{8 \mu L Q}{\pi R {\small\fbox{2074}} } =\frac{8 \ast 8.90 \times 10^{ -4} \ast 997.6 \ast 2}{\pi \ast 0.2^{4}} =\frac{8878.\,6}{\pi } =2826## ##P a##

Are you actually writing the LaTeX, or is Scientific Workplace generating it? Because some of your LaTeX is simply incorrect. \textperiodcentered should not appear in mathmode. The correct command is much simpler: \cdot. Also, I'm not sure where \small\fbox{2074} came from. From the image you shared earlier, it looks like you just want to raise R to the fourth power, which should just be R^4.

You need to be using the commands from the amsmath package, as that is standard, and what is implemented (mostly) on PF.
 
  • Like
Likes   Reactions: PainterGuy and stoomart
  • #14
Hey, PainterGuy!
I don't really have anything useful to contribute regarding your question, but I just wanted to touch base as a fellow SWP 5.5 user. I use it all the time, for almost everything I write which is all day almost every day. It is great software, and the support services are great as well.
 
  • Like
Likes   Reactions: PainterGuy
  • #15
Ben Niehoff said:
Are you actually writing the LaTeX, or is Scientific Workplace generating it? Because some of your LaTeX is simply incorrect. \textperiodcentered should not appear in mathmode. The correct command is much simpler: \cdot. Also, I'm not sure where \small\fbox{2074} came from. From the image you shared earlier, it looks like you just want to raise R to the fourth power, which should just be R^4.

Thank you.

It was generated by SW 6.
 
  • #16
Hi,

Whenever I try to quote a post which uses latex, the quoted post doesn't compile the code. For example, I tried to quote some parts of this post here but it doesn't work.

Could you please help me to resolve this issue?

Thank you!
 
  • #17
PainterGuy said:
Could you please help me to resolve this issue?
highlight-to-quote won't copy the latex because there is underlying code the browser doesn't pickup. You need to click the "reply" link at the end of a post.
 
  • Like
Likes   Reactions: SammyS and PainterGuy

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 3 ·
Replies
3
Views
4K