I got exactly the same text in Chrome as Miller got in Firefox.

Your problem seems not so much translating html in J, but translating (La)Tex 
in J-ish, as you want 
$\displaystyle a_{n+1}=a_n-\frac 1 {a_n}$ for any $n \ge 0$.
be translated in 
NB. a[n+1] =an - 1/an for any n >: 0.

AFAIK there is/was some experience in the forum to do so.


R.E. Boss


-----Original Message-----
From: General <[email protected]> On Behalf Of 'Michael Day' 
via General
Sent: zondag 11 oktober 2020 21:10
To: [email protected]
Subject: Re: [Jgeneral] MathJax to Plain Text!?

I've been using "Avast Secure Browser" for some time, tried M/S Edge for a few 
months, but used to use Firefox for many years!

Yes,  I see that behaviour in Firefox + Noscript, too.  It's a bit better than 
what I had from copy&paste from the "HTML problem view" as available in the 
variant view,  eg
   https://projecteuler.net/minimal=729

Still pretty kludgy.  Looks as if I'll have to write my own conversions,  
assuming the \ is an excape character introducing a MathJax code sequence,  eg 
\frac 1 2 ==> 1/2 (or
1%2 in proper J!),  if I'm
to clean up the pasted version.

Thanks again,

Mike


On 11/10/2020 16:51, Raul Miller wrote:
> Oh, sorry, I misunderstood your question and difficulty.
>
> For something like that, I would use a browser which does not support 
> javascript. (Firefox with the noscript extension installed, 
> specifically, though a text only browser like lynx might work).
>
> Using that approach, here's what I got from copy and paste (without 
> bothering with a text editor to clean it up):
>
> ----------------
>
> Consider the sequence of real numbers $a_n$ defined by the starting 
> value $a_0$ and the recurrence $\displaystyle a_{n+1}=a_n-\frac 1 
> {a_n}$ for any $n \ge 0$.
>
> For some starting values $a_0$ the sequence will be periodic. For 
> example, $a_0=\sqrt{\frac 1 2}$ yields the sequence: $\sqrt{\frac 1 
> 2},-\sqrt{\frac 1 2},\sqrt{\frac 1 2}, \dots$
>
> We are interested in the range of such a periodic sequence which is 
> the difference between the maximum and minimum of the sequence. For 
> example, the range of the sequence above would be $\sqrt{\frac 1 
> 2}-(-\sqrt{\frac 1 2})=\sqrt{ 2}$.
>
> Let $S(P)$ be the sum of the ranges of all such periodic sequences 
> with a period not exceeding $P$.
> For example, $S(2)=2\sqrt{2} \approx 2.8284$, being the sum of the 
> ranges of the two sequences starting with $a_0=\sqrt{\frac 1 2}$ and 
> $a_0=-\sqrt{\frac 1 2}$.
> You are given $S(3) \approx 14.6461$ and $S(5) \approx 124.1056$.
>
> Find $S(25)$, rounded to 4 decimal places.
>
> ----------------
>
> I hope this helps,
>
>
> --
> Raul
>
> On Sun, Oct 11, 2020 at 11:36 AM 'Michael Day' via General 
> <[email protected]> wrote:
>> Thanks for the tip, Raul,  but it doesn't fix the problem for me, at 
>> least with my understanding of your remarks.
>>
>> I assume M/S Wordpad and Notepad are such editors, as you have in 
>> mind, but I'm still not seeing the missing text with either.  Pasting 
>> into a Word-type document, actually into a blank Open Office page,  
>> shows more of the text, but is still not terribly useful,  since %: 
>> 1%2 (as it were in plain J) becomes 12,  still leaving a lot of 
>> hand-editing to be done.
>>
>> Perhaps you could have a look at https://projecteuler.net/problem=729 
>> to see how it works for you.
>>
>> Many regards,
>>
>> Mike
>>
>> On 11/10/2020 16:04, Raul Miller wrote:
>>> In general, for copy and paste problems, nowadays I paste into a 
>>> plain text editor that does not support unicode, where I also fix 
>>> any line length errors before copying and pasting into J.
>>>
>>> Unicode implementations, in their current state, are programming 
>>> language hostile (more specifically, in the Unicode standard, 
>>> there's lots of little recommendations about how programming 
>>> languages implement Unicode which were made in ignorance of the languages).
>>>
>>> --
>>> Raul
>>>
>>>
>>>
>>> On Sun, Oct 11, 2020 at 9:10 AM 'Michael Day' via General 
>>> <[email protected]> wrote:
>>>> I wonder - how do other J-users trying to solve Project Euler 
>>>> problems cope with the (to me) fairly new display format,  which is 
>>>> apparently MathJax?
>>>>
>>>> Using Windows 10,  copy&paste to get the problem statement into my 
>>>> J edit screen used to be adequate to get it where I need it as a 
>>>> set of NB. comment lines.  I'd nearly always have to tweak the 
>>>> quoted text,  but it was manageable.
>>>>
>>>> It's now losing too much information,  and it's tedious typing 
>>>> everything in.  I wasted time solving the relatively easy problem 
>>>> 727 because I'd mis-typed 1 <: ra < rb < rc
>>>> <: 100  with <: everywhere.
>>>>
>>>> Here's a snippet from today's problem,  729,  using the old method:
>>>> "Consider the sequence of real numbers [LF]
>>>>     defined by the starting value [LF]
>>>>     and the recurrence [LF]
>>>>     [LF]
>>>>     for any ."
>>>>
>>>> [I've typed in "[LF]" in this message quote to confirm the 
>>>> gratuitous line-feeds which appear instead of marked-up text 
>>>> elements,  such as an, a0...]
>>>>
>>>> It's possible to capture the explicit markup code from the display, 
>>>> using a widget tagged with
>>>>     "Show HTML problem content"
>>>>
>>>> Here's the same paragraph using that view,  ie copy&pasted from 
>>>> problem 729, https://projecteuler.net/minimal=729
>>>>
>>>> "<p>Consider the sequence of real numbers $a_n$ defined by the 
>>>> starting value $a_0$ and the recurrence
>>>>
>>>> $\displaystyle a_{n+1}=a_n-\frac 1 {a_n}$ for any $n \ge 0$.</p>
>>>>
>>>> <p>"
>>>>
>>>>
>>>> I'd like it to appear in the J script in plain-ish commented text,  eg:
>>>>
>>>> NB. Consider the sequence of real numbers an defined by the 
>>>> starting value a0 and the recurrence
>>>>
>>>> NB. a[n+1] =an - 1/an for any n >: 0.
>>>>
>>>>
>>>> SO - I can soldier on and work up a function or two to translate 
>>>> the data from clipread (in JQt) ,
>>>>
>>>> but I've never seriously got into html,  and suspect I'd be 
>>>> reinventing the wheel from first principles when
>>>>
>>>> someone probably knows this stuff backwards and might even have 
>>>> some suitable code.
>>>>
>>>>
>>>> BTW,  Google has thrown up "pandoc",  and J has addons/format/publish.
>>>> Both are file-based and don't work
>>>>
>>>> on clipboard data as far as I can see so far.
>>>>
>>>>
>>>> Thanks for any help,
>>>>
>>>>
>>>> Mike
>>>>
>>>>
>>>> PS - I've just checked behaviour on the iPad with J701 - copy&paste 
>>>> on that kit has been pretty bad for some time;
>>>>
>>>> it doesn't lose the text, but uses a line feed with every character 
>>>> in an escape sequence. eg
>>>>
>>>> "a_{n+1}= a_n   " becomes
>>>>
>>>> "
>>>>
>>>>
>>>> a
>>>>
>>>> n
>>>>
>>>> +
>>>>
>>>> 1
>>>>
>>>> =
>>>>
>>>> a
>>>>
>>>> n
>>>>
>>>>
>>>> [etc]
>>>>
>>>> "
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> This email has been checked for viruses by Avast antivirus software.
>>>> https://www.avast.com/antivirus
>>>> -------------------------------------------------------------------
>>>> --- For information about J forums see 
>>>> http://www.jsoftware.com/forums.htm
>>> --------------------------------------------------------------------
>>> -- For information about J forums see 
>>> http://www.jsoftware.com/forums.htm
>>
>> --
>> This email has been checked for viruses by Avast antivirus software.
>> https://www.avast.com/antivirus
>>
>> ---------------------------------------------------------------------
>> - For information about J forums see 
>> http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to