autocorrect the whole math equations within ms-word - math

I have written a plain text in notepad editor. This text contains some embedded mathematical formulas like \sumw_if(x_i) which refers to \sumw_if(x_i) or \alpha^2 + \beta^2 = \gamma^2 which refers to \alpha^2 + \beta^2 = \gamma^2etc.
Now, I'm looking for a way to autocorrect all those formulas within ms-word. First I tought to select formulas one by one and then "ALT +" to get the maths notation. This method works fine but it's frustrating because I have a bunch of equations
Is there any help? Macros, MathML or other tips?
Regards

If the embedded mathematical formulas were delimited with dollar signs -- e.g., $\alpha^2 + \beta^2 = \gamma^2$ -- MathType can do it with its Toggle TeX feature. If it's something you want to do programmatically, there's the MathType SDK.

Related

How to print an asterisk ('*') in R Markdown

I am trying to write in my R Markdown "3 times 6:10 and (3 times 6):10" all in complete letters (I am using times instead of *. My purpose is to put * instead of word times without any problem). However, it keeps giving me italic syntax for the part "6:10 and (3". How can I write my *s in R Markdown straight into the document without evoking * syntax which is make letters italic in the middle?
Escape '*' by using '\*' instead
Alternatively, you could use $\times$ to get the '×' symbol
On the web use *
That's one of it's HTML codes.
(Only mention it because google brought me here when I didn't search about the R language and figure others will end up here as well.)
Markdown is quite sensitive to whitespace. If you don't put spaces around the * (line 3 below) you get the problem you're describing (markdown assumes the *s are italic-delimiters).
Some possible solutions
line 5: add spaces, no problem (except you might not want that spacing)
line 7 (#CaptainHat): set times as a LaTeX times symbol
line 9: set in code format
line 11 (#CaptainHat): protect *s with backslashes
Also tried #CaptainHat's suggestions as well as type-setting in code format ...)

paste0 regular and italicized text in R

I need to concatenate two strings within an R object: one is just regular text; the other is italicized. So, I tried a lot of combinations, e.g.
paste0(" This is Regular", italic( This is Italics))
The desired result should be:
This is Regular This is Italics
Any ideia on how to do it?
Thanks!
In plot labels, you can use expressions, see mathematical annotation :
plot(1,xlab=expression("This is regular"~italic("this is italic")))
To provide an string for which an HTML parser will recognise the need to render the text in Italics, wrap the text in <i> and </i>. For example: "This is plain text, but <i>this is in Italics</i>.".
However, most HTML processors will assume that you want your text to appear as-is and will escape their input by default. This means that the special meanings of certain characters - including < and > will be "turned off". You need to tell the processor not to do this. How you do that will depend on context. I can't tell you that because you haven't given me context.
Are you for example, writing to a raw HTML file? (You need do nothing.) Are you writing to a Markdown file? If so, how? In plain text or in a rendered chunk? Are you writing a caption to a graphic? (Waldi has suggested a solution.) Etc, etc....

Create new emphasis command R Markdown

In R Markdown, to make a text bold, we just need to do:
**code**
The the word code shows in bold.
I was wondering if there is a way to create a new command, let's say:
***code***
That would make the text highlighted?
Thanks!
It is not easily possible to create new markup, but one can change the way existing markup commands are rendered. Text enclosed by three stars is interpreted as emphasized strong emphasis. So one has to change that interpretation and change it to something else. One way to do so is via pandoc Lua filters. We just have to match on pandoc's internal representation of emphasized strong text and convert it to whatever we want:
function Strong (strong)
-- if this contains only one element, and if that element
-- is emphasized text, convert it to highlighted text.
local element = #strong.content == 1 and strong.content[1]
if element and element.t == 'Emph' then
table.insert(element.content, 1, pandoc.RawInline('html', '<mark>'))
table.insert(element.content, pandoc.RawInline('html', '</mark>'))
return element.content
end
end
The above works for HTML output. One would have to define what "highlighted text" means for each targeted format.
See this and this question for other approaches to the problem, and for details of how to use the filter with R Markdown.

Strip Math ML (Convert to plain text)

I am working on a project that imports technical documents into a tracking system. A small number of the publications contain embedded HTML. This is normal and we strip out the HTML which is typically used to add formatting such as bold or italics to body text.
Now we are receiving documents containing MathML. Are there any libraries (or approaches) out there that will strip the markup and give a reasonable text equivalent? I realize that that MathML allows for graphical representations, but even those have text equivalents.
To do this you would have to process the MathML and interpret it. Unlike in the case of removing html markup, stripping the tags would normally strip the meaning from the formula.
So you will need a mathml parser. Two do come to mind, both by David Carlisle, and both xslt based: pmml2tex converts to Latex format, which is often more or less readable: your example would be rendered as \frac{a+b+c}{2\times 5}
Alternatively pmathmlascii does little ascii art representations of mathml. Your example would render as
a + b + c
---------
2 * 5
or similar.
Both stylesheets can be found on google code, and are discussed at https://code.google.com/p/web-xslt/wiki/Overview

How can I put text , image and symbols together through one field

I am creating a website for creating test papers for maths , physics etc, as it is not accepting special symbols.
(1.) If sin(symbol theta) then the general value of is
(a) 2n(pie symbol)
(b) 4(pie symbol)
(c)
(d) None of these
I have done rest all but it is taking only simple text questions , not symbols.
How to do that?
A quick search on Google lead me here: http://barzilai.org/math_sym.htm.
So, instead of typing the word, or trying to copy in the symbol from whatever text editor you are using, simply copy in the little set of characters from this website, and it should show the character in the website.
Here you see a conversion table http://htmlhelp.com/reference/html40/entities/symbols.html
Usage
You can just use it in your HTML, for instance
<div>This is the capital letter phi: Φ</div>

Resources