I want to use \cancel{·} in mathjax. with a crossed line of different color, explained here.
I use
\[
enter code here
\require{xcolor}
\require{cancel}
\renewcommand\CancelColor{\color{red}}
\cancel{x^2}
\]
But is not working. Any ideas?
for future references, a good answer was given in tex Stack Exchange
here
Related
My apologies if this is such a trivial question for most, but it is not readily obvious to me and I can't find an answer. I am trying to understand how to code syntax highlighting for vi, but the syntax used [for the syntax highlighting] eludes me. For example, I know that
syn match myNumber '\d\+'
hi myNumber ctermfg=blue
will highlight positive integers blue. What confuses me is the '\d\+' part. Playing around it seems that \d means digit and \+ means several? But I have no idea what this syntax is called and thus can't find any documentation that could help me. I have only found links of people using it without explanation. I can probably decipher how
'[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+'
means 'positive and negative numbers with decimals and exponents', but if I am to make more complex highlighting I don't know where to begin. Does anybody know of any documentation that I could use to learn this?
That's called a "regular expression" or regex (or regexp) for short. See :help pattern and :help usr_27.txt. Also see vimregex.com.
I would like to be able to change the way Maxima generates the LaTeX code (in general). For example, I have the following code in Maxima:
I then exported the code to LaTeX, and I immediately get an error saying:
! Package inputenc Error: Unicode char \u8:− not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
You can check out the LaTeX code generated through this gist on GitHub.
I would like at least not only to not get any errors, but also to change a little bit the style of the LaTeX code generation to adapt it to certain circumstances. For example, I would like to be able to insert a break line (or more) after the outputs...
Is it possible to do? Are there any alternatives?
You can put the following line in the preamble of the LaTeX output:
\DeclareUnicodeCharacter{2212}{-}
which tells LaTeX what to do with the Unicode hyphen (character 2212 according to this table).
WxMaxima should generate this declaration itself -- it is a bug that it does not.
Most likely something happened when you exported the code. To fix the existing file you can follow the accepted answer to this question.
https://tex.stackexchange.com/questions/83440/inputenc-error-unicode-char-u8-not-set-up-for-use-with-latex
But try exporting again and see if the error was accidental.
Update:
Add
\DeclareUnicodeCharacter{00A0}{ }
to your preamble.
Well, the gistfile1.txt at line 54 contains − characters instead of -. I wonder how those characters were generated. What commands did you enter in wxMaxima to generate gistfile1.txt?
Anyway, I find that if I replace those characters with ordinary hyphens, it avoids the error you reported. So perhaps the problem is to avoid generating those characters in the first place.
EDIT: This answer is off the mark. See my other answer for a real solution.
Anybody, any idea??
which plugin is showing the indentation guide in the image below. Downloaded from http://leetless.de/images/vim/pyte.png
.png
Thanks
A similar effect could be achieved with:
set list
set listchars+=tab:\│┈
Maybe with another filler character.
See :help 'list' and :help 'listchars'.
But…
As I was writing that answer it appeared to me that the answer was probably in the colorscheme's author's ~/.vimrc.
I think that you should really work on sharpening your deduction skills. It takes about 30 seconds to 1 minute to find that information by yourself:
Go to the site where you get that pic from: http://leetless.de
Look around for something Vim-related. The navigation is generally the first place to go and what do you find? "Vim themes" at http://leetless.de/vim.html
That image illustrates the first "theme" featured, that's a good sign. But let's read the introduction text (emphasis mine, typos his):
If you are curious what some other things are (like the indetation markers) and how they work, take a look at my .vimrc. Note that the encoding is broken with that file so the "set lcs" part is probably not copy-pasteable, follow the instructions in the comments above that line in order to find out how you can make your own unicode-lcs.
Wow! It looks like you are getting closer to the truth. Beware of the Cigarette Man!
Follow the link and do a search for lcs.
Done.
Not sure what you mean by "indentation guide", but I don't think any plugin is involved.
The first thing I see that you might be referring to is the characters at the beginning of lines indicating where there are tabs. That can be done by doing setting the listchars option to an appropriate value, turning the list option on, and selecting a color for the SpecialKey highlight group.
The other thing you might be referring to is highlighting of the column that currently contains the cursor. That can be done by turning on the cursorcolumn option. The color used for that can be set with the CursorColumn highlight group.
There's also a plugin, vim-indent-guides
Here's a nice plugin for vim: https://github.com/Yggdroot/indentLine
I think vim can really do this. I just don't know my way arround search and replace using regex. Can anyone help me around this one.
Update
Thanks to Chris below for helping me around this one. Here is the map.
map <leader>rc :%s#\v/\*([^*]\|[\r\n]\|(\*+([^*/]\|[\r\n])))*\*+/##g<cr>
:%s#/\*\([^*]\|[\r\n]\|\(\*\+\([^*/]\|[\r\n]\)\)\)*\*\+/##g will get rid of all CSS comments (note that's using # rather than / as the delimiter to avoid escaping the \
You can also use \v, the "very magic" flag (read :help \v), and not need to make the ()|+ characters magic: :%s#\v/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/##g.
(This answer is just extending jball's answer by putting in the Vim syntax for it.)
Here's a regex (from Stephen Ostermiller) that should match C style (e.g., /* ... */ and hence CSS) comments:
/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/
Note: this will probably need adaptation to VIM's specific flavor of regex.
I'm not sure this is possible, but I'm interesting in making this happen.
Ideally, I would like to map this feature to SHIFT+CTRL+3.
I'm looking for a way to have Vim enter a comment (single line) which corresponds to the syntax of the file I'm editing. If there are multiple single-line comment styles, Vim could either automatically pick one, or give me the choice. If the single-line comment has two parts (e.g. /* and */), then pressing SHIFT+CTRL+3 the first time will start the comment, and the second time will close the comment.
Examples:
Python: #
JavaScript: //
C, C++: /* with */ or //
I know there are scripts which will insert comments for you, but I haven't seen any that will do this based on the syntax of the file.
I highly recommend NERD Commenter.
Sort of! I don't believe vim will do this out of the box, but you can install plugins that will do fairly intelligent commenting (using movement keys, visual line highlighting, etc) that are specific to the filetype being edited. You can get these plugins off of vim.org, and you should be able to make your own key mappings in your .vimrc file if you don't like the ones they come with.
tComment is pretty well regarded, and has worked for me.
I've heard that EnhCommentify might be better, but I haven't used it myself.
Seems like a similar question to this:
How to comment in vim while respecting the indent?
Use the nerd commenter plugin:
http://www.vim.org/scripts/script.php?script_id=1218
See: this script which provides a function to commented a highlighted area in visual mode.
You want to start a comment in insert mode so your function would look more like:
fun CommentLines()
exe ":s#^#".g:Comment."#g"
endfun
Not quite what you're looking for, but efficient, and I suppose you know which comment to use.
(all this in command mode)
Put your cursor to the first line you want to comment. We willl then set a marker called a (valid names are a-z, single character) by typing
ma
put the cursor to the last line, then set a marker called b by typing
mb
Then comment the whole block (by searching for a newline and inserting the comment character (note the use of "#" as search delimiter because otherwise wee have to escape the "/")
:'a,'bs#^#//#
or for Python:
:'a,'bs/^/#/
To uncomment:
:'a,'bs#^//##
As we do line comments, it doesn't matter if we have other comments already in the file, they will be preserved.