Equation numbering in Rmarkdown, output to word - r-markdown

I am trying to knit a .Rmd file to a word file, where I need to include equations and their numbers.
The code I tried looks like below:
$$
\begin{cases}
\tag{1}
\frac{dX}{dt}=a\\\frac{dY}{dt}=b
\end{cases}
$$
But this doesn't work.
There is a similar question
Equation Numbering in Rmarkdown - For Export to Word
Yet the answer doesn't work for me. I am wondering if anyone have a good solution to this.
Thanks a lot!

Welcome to SO, #user15578296.
Here is your equation ready for Word:
---
output: word_document
---
$$\begin{cases} \frac{dX}{dt}=a\\\frac{dY}{dt}=b \end{cases}$$
Regarding the numbering, you should follow the answer provided in your mentioned linked question.

Related

Need help in ignoring certain lines when reading a file so that I don't have to include them in the calculations using VScode

Okay, so I am writing a program that reads a file and prints all the lines in it. I don't want it to print lines that start with # and + and print all the other lines.
The code that I have written looks like this Code
The output looks like the following Output. So I want the output to print only those lines without starting with + and #.
I have stuck with this problem for a while and will really appreciate it if anyone can provide any hints as to what to do?
Thanks in Advance
Sorry I couldn't format the right coding style on stack overflow because I'm new but if you need help in understanding it don't hesitate to ask me
Regards,
Abdul Hadi

VSCode Snippets: Format File Name from my_file_name to MyFileName

I am creating custom snippets for flutter/dart. My goal is to pull the file name (TM_FILENAME_BASE) remove all of the underscores and convert it to PascalCase (or camelCase).
Here is a link to what I have learned so far regarding regex and vscode's snippets.
https://code.visualstudio.com/docs/editor/userdefinedsnippets
I have been able to remove the underscores nicely with the following code
${TM_FILENAME_BASE/[\\_]/ /}
I can even make it all caps
${TM_FILENAME_BASE/(.*)/${1:/upcase}/}
However, it seems that I cannot do two steps at a time. I am not familiar with regex, this is just me fiddling around with this for the last couple of days.
If anyone could help out a fellow programmer just trying make coding simpler, it would be really appreciated!
I expect the output of "my_file_name" to be "MyFileName".
It's as easy as that: ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}
For the camelCase version you mentioned, you can use:
${TM_FILENAME_BASE/(.*)/${1:/camelcase}/}

trying to stem a string in natural language using python-2.7

I am importing from nltk.stem.snowball import SnowballStemmer
and I have a string as follows:
text_string="Hi Everyone If you can read this message youre properly using parseOutText Please proceed to the next part of the project"
I run this code on it:
words = " ".join(stemmer.stem(word) for word in text_string.split(" "))
and I get the following which has a couple of 'e' missing. Can't figure out what is causing it. Any suggestions? Thanks for the feedbacks
"hi everyon if you can read this messag your proper use parseouttext pleas proceed to the next part of the project"
You're using it correctly; it's the stemmer that's acting weird. It could be caused by too little training data, or the wrong balance, or simply the wrong conclusion by the stemmer's statistical algorithm. We can't expect perfection, but it's annoying when it happens with common words. It's also stemming "everything" to "everyth", as if it's a verb. At least here it's clear what it's doing. But "-e" is not a suffix in English...
The stemmer allows the option ignore_stopwords=True, which will suppress stemming of words in the stopword list (these are common words, usually irregular, that Porter thought fit to exclude from the training set because he got worse results when they are included.) Unfortunately it doesn't help with the particular examples you ask about.

Emacs regexp - replacing text strings, query replace regexp

It seems simple enough but I can't get it done.
My text file looks like this :
Johnson Cary, 2009, This important article, 109 pages.
Smith Tom, 2003, Much ado about nothing: a study, 89 pages.
I need this :
Johnson Cary%2009%This important article%109 pages.
Any special character unlikely to appear in text will do. The end goal is to end up with a .csv then a .xls file.
I am using
^\([^,]+\)\([,]\)
to find the first occuring comma but when I try to replace with
\1 %
it does not work, nor any kind of close combination of that sort for that matter.
Any help will be dearly welcome!
Thank you much in advance.
Replace this:
^\([^,]*\), \([^,]*\), \([^,]*\), \(.*\)$
with this:
\1%\2%\3%\4
to get the correct result.

For the grammar given, provide 3 valid example strings

today I got a homework on my 'Programming Languages' class and I'm having trouble. Here is the full question;
For the grammars given below, draw transition diagram and transition
table. Provide 3 valid example strings.
And this is the one I'm having trouble with;
1?1.(0|1)+
I don't really know what the question mark (?) stands for on this example, and I couldn't find an online paper. I don't want any help on diagram or the table, I could make them if I knew what '?' means. Please help me with this, thanks in advance.
Usually the question mark ? stands for 0 or 1 time
So 1? will match "" (empty) and "1"