Author Topic: LaTex for EEVBlog  (Read 19687 times)

0 Members and 1 Guest are viewing this topic.

Offline MorgorothTopic starter

  • Regular Contributor
  • *
  • Posts: 123
  • Country: cl
LaTex for EEVBlog
« on: February 09, 2016, 04:44:17 pm »
there is a chance to enable LaTex support for the EEVBlog ?, I have a small blog and I'm using mathjax, is very very easy to use, only have to edit a template on blogger and that's it, probably more complicated here, but could be very handy and worth the effort.
----------------------------------------------------------
If works, doesn't means it is right.
 

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2084
Re: LaTex for EEVBlog
« Reply #1 on: February 09, 2016, 04:52:54 pm »
+1

Although, I think this particular subject has been raised before and the response was lukewarm. :(

 

Offline Maxlor

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: LaTex for EEVBlog
« Reply #2 on: February 10, 2016, 12:04:51 am »
LaTeX? Hell, just having unicode would be nice, so you could actually use a micro or ohm symbol. That hasn't happened either, though, so don't hold your breath for mathjax :(
 

Offline HAL-42b

  • Frequent Contributor
  • **
  • Posts: 423
Re: LaTex for EEVBlog
« Reply #3 on: February 10, 2016, 12:08:00 am »
+1 for LaTeX support.
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: LaTex for EEVBlog
« Reply #4 on: February 10, 2016, 12:23:40 am »
I'd rather have a canvas. Some years ago I searched such thing for a site I have, but only found a plugin that would let you either write or have the canvas, but not both. Don't know what exists today.
« Last Edit: February 10, 2016, 12:25:59 am by nuno »
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37734
  • Country: au
    • EEVblog
Re: LaTex for EEVBlog
« Reply #5 on: February 10, 2016, 09:55:05 am »
I can't install it:
http://custom.simplemachines.org/mods/index.php?mod=1111
I get an error and ti warns me not to install. It's a 6 years old mod.
 

Offline MorgorothTopic starter

  • Regular Contributor
  • *
  • Posts: 123
  • Country: cl
Re: LaTex for EEVBlog
« Reply #6 on: February 10, 2016, 01:59:28 pm »
seems to be another approach for this:

http://www.simplemachines.org/community/index.php?topic=535624.msg3805548#msg3805548

only you have to edit a template files and that's it, no mod at all, refer to attached images for reference, one from simplemachines forum, another from mathjax documentation, and finally how I did it to enable LaTeX.


« Last Edit: February 10, 2016, 02:02:52 pm by Morgoroth »
----------------------------------------------------------
If works, doesn't means it is right.
 

Offline MatthewEveritt

  • Supporter
  • ****
  • Posts: 136
  • Country: gb
Re: LaTex for EEVBlog
« Reply #7 on: February 10, 2016, 05:02:22 pm »
 
I can't install it:
http://custom.simplemachines.org/mods/index.php?mod=1111
I get an error and ti warns me not to install. It's a 6 years old mod.

A pity, the reason for the error seems to simply be a pretty minor formatting issue. Just different enough to not work.
If you're going to go to the bother of manually fixing things it doesn't really seem worth it for something six years out of date.

seems to be another approach for this:

http://www.simplemachines.org/community/index.php?topic=535624.msg3805548#msg3805548

only you have to edit a template files and that's it, no mod at all, refer to attached images for reference, one from simplemachines forum, another from mathjax documentation, and finally how I did it to enable LaTeX.

This seems to work really well. It does seem to require manually including the script, but I would be surprised if there was a mod available to make that easy.
I'd  recommend using
Code: [Select]
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({tex2jax: {inlineMath: [['\\$','\\$'], ['\\(','\\)']]}});
</script>

<script type="text/javascript"
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

so \$math\$ is inline as well as the default \(math\). This is just a personal preference, but it seems the most like native LaTeX that doesn't wreak havoc when single $ signs are used.
« Last Edit: February 10, 2016, 05:11:50 pm by MatthewEveritt »
 

Offline MorgorothTopic starter

  • Regular Contributor
  • *
  • Posts: 123
  • Country: cl
Re: LaTex for EEVBlog
« Reply #8 on: February 10, 2016, 05:38:38 pm »
I bet you had problems with the 'async' attribute, if it was, you can solve it in this way:

Code: [Select]
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
    </script>
    <script type="text/javascript" async="async"
      src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML">
    </script>
----------------------------------------------------------
If works, doesn't means it is right.
 

Offline MatthewEveritt

  • Supporter
  • ****
  • Posts: 136
  • Country: gb
Re: LaTex for EEVBlog
« Reply #9 on: February 10, 2016, 05:57:36 pm »
I didn't have problems, I was just using a trivial file to play with the script. I agree that async might be a sensible addition.

I'd advice against using inlineMath: [['$','$']] as sentences like " $10 each, or three for $25", or whatever, will become unreadable.

 

Offline MorgorothTopic starter

  • Regular Contributor
  • *
  • Posts: 123
  • Country: cl
Re: LaTex for EEVBlog
« Reply #10 on: February 10, 2016, 06:15:30 pm »
you're right about the inline delimiter, the problem is I have to change all the LaTeX references in the blog |O, so, work for night late.

thanks for the tip.
----------------------------------------------------------
If works, doesn't means it is right.
 

Offline MatthewEveritt

  • Supporter
  • ****
  • Posts: 136
  • Country: gb
Re: LaTex for EEVBlog
« Reply #11 on: February 10, 2016, 09:36:23 pm »
Dave, on the off-chance that we can persuade you :

Looks like there is a mod that makes this really easy :  http://custom.simplemachines.org/mods/index.php?mod=2686.

Once it's installed you get a new option under "Admin->Configuration->Modification settings->Custom </head> and </body> Scripts".  Just past
Code: [Select]
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({tex2jax: {inlineMath: [['\\$','\\$'], ['\\(','\\)']]}});
</script>

<script type="text/javascript" async="async"
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
Hit save and it should be done.

 I just tested it on SMF 2.0.11 (clean install just for this) and it works like a charm. Obviously there's always a chance that it'll conflict with some other mod you have installed, but it doesn't seem likely.
 

Offline MorgorothTopic starter

  • Regular Contributor
  • *
  • Posts: 123
  • Country: cl
Re: LaTex for EEVBlog
« Reply #12 on: February 10, 2016, 11:43:44 pm »
please....

----------------------------------------------------------
If works, doesn't means it is right.
 

Offline bitwelder

  • Frequent Contributor
  • **
  • Posts: 967
  • Country: fi
Re: LaTex for EEVBlog
« Reply #13 on: February 11, 2016, 11:04:05 pm »
please....

Picture of a cat is not the best image to move Dave, I think...
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: LaTex for EEVBlog
« Reply #14 on: February 11, 2016, 11:22:48 pm »
Pleeeeeeease?

No longer active here - try the IRC channel if you just can't be without me :)
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37734
  • Country: au
    • EEVblog
Re: LaTex for EEVBlog
« Reply #15 on: February 12, 2016, 12:53:19 am »
Dave, on the off-chance that we can persuade you :

Looks like there is a mod that makes this really easy :  http://custom.simplemachines.org/mods/index.php?mod=2686.

Once it's installed you get a new option under "Admin->Configuration->Modification settings->Custom </head> and </body> Scripts".  Just past
Code: [Select]
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({tex2jax: {inlineMath: [['\\$','\\$'], ['\\(','\\)']]}});
</script>

<script type="text/javascript" async="async"
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
Hit save and it should be done.

 I just tested it on SMF 2.0.11 (clean install just for this) and it works like a charm. Obviously there's always a chance that it'll conflict with some other mod you have installed, but it doesn't seem likely.

Done.
I have no idea how to test it.
 

Offline MorgorothTopic starter

  • Regular Contributor
  • *
  • Posts: 123
  • Country: cl
Re: LaTex for EEVBlog
« Reply #16 on: February 12, 2016, 01:13:52 am »
test

\$V_{o}=A \cdot ( V_{+}-V_{-} ) \$

nice !!!, it don't show on preview, but is a minor problem...

THANK YOU VM !!!
« Last Edit: February 12, 2016, 01:17:49 am by Morgoroth »
----------------------------------------------------------
If works, doesn't means it is right.
 

Offline MatthewEveritt

  • Supporter
  • ****
  • Posts: 136
  • Country: gb
Re: LaTex for EEVBlog
« Reply #17 on: February 12, 2016, 01:15:13 am »
Awesome, thank you. It seems to work just fine.

A slightly more complex test: \[\chi=<{m}>+<{m}>^2\left(\frac{\tau_c^2}{2T^2}\left[exp\left( \frac{-2T}{\tau_c}\right)-1+\frac{2T}{\tau_c}\right]\right)\]
 

Offline liquibyte

  • Frequent Contributor
  • **
  • Posts: 475
  • Country: us
Re: LaTex for EEVBlog
« Reply #18 on: February 12, 2016, 01:15:35 am »
I was working on it too to see what got supported.


Tex
The quadratic formula is $$-b \pm \sqrt{b^2 - 4ac} \over 2a$$ \bye

Latex
E &= \frac{mc^2}{\sqrt{1-\frac{v^2}{c^2}}}

AsciiMath
sum_(i=1)^n i^3=((n(n+1))/2)^2

 

Offline MatthewEveritt

  • Supporter
  • ****
  • Posts: 136
  • Country: gb
Re: LaTex for EEVBlog
« Reply #19 on: February 12, 2016, 01:30:32 am »
A couple of simple examples to show how to use \$\LaTeX\$ in forum posts.

Code: [Select]
In line math \$R=123\mu\Omega\$ is done with dollar signsIn line math \$R=123\mu\Omega\$ is done with dollar signs


Code: [Select]
Display math \[P=\frac{V^2}{R}\] is done with square brackets.  Display math \[P=\frac{V^2}{R}\] is done with square brackets.
« Last Edit: February 12, 2016, 01:50:37 am by MatthewEveritt »
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: LaTex for EEVBlog
« Reply #20 on: February 12, 2016, 01:44:17 am »
\[w^{o^{o^{o^o}}}\]

 :-+
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: LaTex for EEVBlog
« Reply #21 on: February 12, 2016, 05:17:01 am »
It does not work on the mobile version of the forum.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: LaTex for EEVBlog
« Reply #22 on: February 12, 2016, 05:34:17 am »
N.B. Anyone running a javascript blocker like NoScript, will need to add an exception for cdn.mathjax.org
 

Offline HAL-42b

  • Frequent Contributor
  • **
  • Posts: 423
Re: LaTex for EEVBlog
« Reply #23 on: February 12, 2016, 03:03:44 pm »
$${\LaTeX}$$

$$ \newcommand\T{\Rule{0pt}{1em}{.3em}}
\begin{array}{|c|c|}
\hline X & P(X = i) \T \\\hline
  1 \T & 1/6 \\\hline
  2 \T & 1/6 \\\hline
  3 \T & 1/6 \\\hline
  4 \T & 1/6 \\\hline
  5 \T & 1/6 \\\hline
  6 \T & 1/6 \\\hline
\end{array}$$

MathJax doesn't implement tabular, because it is really a text-mode environment. You can use the array environment as a replacement. Source
« Last Edit: February 12, 2016, 03:20:43 pm by HAL-42b »
 

Offline calli

  • Regular Contributor
  • *
  • Posts: 100
  • Country: de
  • 3D Blender and Maker
    • Blender Buch
Re: LaTex for EEVBlog
« Reply #24 on: March 15, 2016, 01:36:11 pm »
Hey, thats a nice addition!

However it is so long ago that I used it... 1989 my Diploma Thesis and 1999-2009  for writing my book the first three editions (then we switched to "Word" and Indesign....gnaaaa.). In case you wonder: http://blenderbuch.de/ (be warned, pesky german).

Cheers,
Carsten
Carsten Wartmann: Make Magazin DE - Autor - Dozent - 3D - Grafik - Maker
http://blenderbuch.de/
 

Offline MorgorothTopic starter

  • Regular Contributor
  • *
  • Posts: 123
  • Country: cl
Re: LaTex for EEVBlog
« Reply #25 on: March 15, 2016, 02:17:50 pm »
why not translate to pesky English ?   ^-^
----------------------------------------------------------
If works, doesn't means it is right.
 

Offline calli

  • Regular Contributor
  • *
  • Posts: 100
  • Country: de
  • 3D Blender and Maker
    • Blender Buch
Re: LaTex for EEVBlog
« Reply #26 on: March 15, 2016, 02:39:36 pm »
Actually the second edition was translated to English and published by nonstarch press. And then they translated that into Italian and Indonesien. Quite strange languages 😁😁😈😈

Carsten
Carsten Wartmann: Make Magazin DE - Autor - Dozent - 3D - Grafik - Maker
http://blenderbuch.de/
 

Offline Zbig

  • Frequent Contributor
  • **
  • Posts: 927
  • Country: pl
Re: LaTex for EEVBlog
« Reply #27 on: April 10, 2016, 11:40:18 am »
Testing Tex export from Casio FX-991EX QR code function. The calculator generates a QR code you can scan with your smart device. From there, you can e-mail yourself a link to wes.casio.com service with your result. Tex format is available there, among others. Here it goes:

\$\frac{4\rm{\pi}{\left(6.37814\rm{k}\right)}^{3}}{3.2\rm{M}}\$

Oh, bummer. Does anyone have a clue what went wrong?

Ok, figured it out. Had to enclose the whole thing as is in the backslash-dollar tags.

In case anyone is interested, that's the link the calculator has generated as a QR code:
http://wes.casio.com/math/index.php?q=I-23B-+U-000000000000+M-C10000AD00+S-001410101000110E1010B0000542+R-0101892455638533010600000000000000000000+E-C81D1A342260362E3337383134E2D0C91A331B1B1A332E32E11B1E

Ok, I cheated ;) I don't really have this calculator yet. Just scanned the sample code from CASIO's marketing material on the site (image of a calculator displaying the code, actually). But I'm sold now. Running out to grab one right away!
« Last Edit: April 10, 2016, 02:38:57 pm by Zbig »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: LaTex for EEVBlog
« Reply #28 on: April 10, 2016, 02:32:42 pm »
EEVblog's implementation of LaTex support using mathjax is currently unsafe and allows posters to inject arbitrary javascript.  See https://www.eevblog.com/forum/chat/so-now-we-can-get-mathy-in-here/msg868990/#msg868990

Can something be done about the security issue?
 

Offline Zbig

  • Frequent Contributor
  • **
  • Posts: 927
  • Country: pl
Re: LaTex for EEVBlog
« Reply #29 on: April 10, 2016, 02:41:33 pm »
EEVblog's implementation of LaTex support using mathjax is currently unsafe and allows posters to inject arbitrary javascript.  See https://www.eevblog.com/forum/chat/so-now-we-can-get-mathy-in-here/msg868990/#msg868990

Can something be done about the security issue?

Oh, that's unfortunate :( Have you tried PMing Dave about that one?
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37734
  • Country: au
    • EEVblog
Re: LaTex for EEVBlog
« Reply #30 on: April 10, 2016, 11:51:02 pm »
EEVblog's implementation of LaTex support using mathjax is currently unsafe and allows posters to inject arbitrary javascript.  See https://www.eevblog.com/forum/chat/so-now-we-can-get-mathy-in-here/msg868990/#msg868990
Can something be done about the security issue?

I can disable the feature entirely?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: LaTex for EEVBlog
« Reply #31 on: April 11, 2016, 03:21:08 am »
To enable safe mode, which prevents javascript in LaTex etc. you need to add ,Safe at the end of the full URL + parameters in the line in the header that invokes Mathjax.
See http://mathjax.readthedocs.org/en/latest/safe-mode.html
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37734
  • Country: au
    • EEVblog
Re: LaTex for EEVBlog
« Reply #32 on: April 11, 2016, 04:13:05 am »
To enable safe mode, which prevents javascript in LaTex etc. you need to add ,Safe at the end of the full URL + parameters in the line in the header that invokes Mathjax.
See http://mathjax.readthedocs.org/en/latest/safe-mode.html

I don't know how to use that, I'm using a plugin.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: LaTex for EEVBlog
« Reply #33 on: April 11, 2016, 04:31:49 am »
If you are still using it the way you set up here: https://www.eevblog.com/forum/suggestions/latex-for-eevblog/msg866703/#msg866703, just edit the custom script to insert the ,Safe immediately before the "> on the line with the mathjax URL
Code: [Select]
<script type="text/javascript" async="async"
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML,Safe">
</script>
 
The following users thanked this post: EEVblog

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37734
  • Country: au
    • EEVblog
Re: LaTex for EEVBlog
« Reply #34 on: April 11, 2016, 04:35:11 am »
If you are still using it the way you set up here: https://www.eevblog.com/forum/suggestions/latex-for-eevblog/msg866703/#msg866703, just edit the custom script to insert the ,Safe immediately before the "> on the line with the mathjax URL
Code: [Select]
<script type="text/javascript" async="async"
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML,Safe">
</script>

Added, thanks.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: LaTex for EEVBlog
« Reply #35 on: April 11, 2016, 05:11:39 am »
I've just checked the test post in the other topic.  Clicking the = now does absolutely nothing so it looks like that vulnerability is now safely blocked.
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2450
  • Country: gr
Re: LaTex for EEVBlog
« Reply #36 on: August 28, 2016, 10:32:05 am »
Is there a way to make \$\LaTeX\$ work for post Preview?

Alexander.
« Last Edit: August 28, 2016, 10:37:25 am by firewalker »
Become a realist, stay a dreamer.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf