How to make groups of symbols bold with Mathjax - mathjax

I want to be able to make several symbols bold by grouping them within some sort of bolding command. I can make a single symbol bold by using (for example)
\boldsymbol \phi
but I want to be able to bold several symbols, something like:
{\boldsymbol \phi \vee \psi}
This doesn't work. I've tried \bf in a group as well, which Mathjax says it supports, but it doesn't.
How can I achieve this, I don't want to have to put \boldsymbol on every single symbol!

Use \boldsymbol{\phi \vee \psi}. Note that \boldsymbol is a macro that takes an argument (like \mathbf{}), not a switch (like \bf). Also, note that in TeX, \bf only affects certain symbols (basically, just the letters and numbers), and MathJax does the same. So in TeX, as well as MathJax, {\bf \phi \vee \psi} will produce the same thing as \phi \vee \psi.

Related

Setting a sign to highlight only text instead of whole line in Vim

When defining a :sign you can use the linehl argument to assign a highlight group for the whole line the sign is placed in.
This highlights the whole line until the end, but how I do to highlight only the text of that line?
Edit: The idea is to use Syntastic to show the errors and warnings, but I can't redefine the SyntasticStyleError sign to do what I want. It highlights all the line instead of only the text of that line.
It is not possible as far as I know. Look at the :h sign-define:
:sign define {name} {argument}...
Define a new sign or set attributes for an existing sign.
The {name} can either be a number (all digits) or a name
starting with a non-digit. Leading digits are ignored, thus
"0012", "012" and "12" are considered the same name.
About 120 different signs can be defined.
Accepted arguments:
icon={bitmap}
Define the file name where the bitmap can be found. Should be
a full path. The bitmap should fit in the place of two
characters. This is not checked. If the bitmap is too big it
will cause redraw problems. Only GTK 2 can scale the bitmap
to fit the space available.
toolkit supports ~
GTK 1 pixmap (.xpm)
GTK 2 many
Motif pixmap (.xpm)
Win32 .bmp, .ico, .cur
pixmap (.xpm) |+xpm_w32|
linehl={group}
Highlighting group used for the whole line the sign is placed
in. Most useful is defining a background color.
text={text} *E239*
Define the text that is displayed when there is no icon or the
GUI is not being used. Only printable characters are allowed
and they must occupy one or two display cells.
texthl={group}
Highlighting group used for the text item.
It does not offer you a straight-forward way to distinguish between the text background colour and the background colour of the line - in fact, you can only set the linehl parameter.
Maybe there is a hacky way to do what you want. I've stumbled upon this link you might find useful: https://sunaku.github.io/vim-256color-bce.html
Another interesting idea is explained on vim.wikia.com (link) in the Highlighting that stays after cursor moves section. It suggests using the following command:
:nnoremap <silent> <Leader>l ml:execute 'match Search /\%'.line('.').'l/'<CR>
This way you might mix it with the information you get from :sign place and replace signs with your custom highlighting method I posted above. It requires some scripting though.

Syntax Highlighting with Fine Granularity

Is there a way to assign an individual character, as identified by a height and depth index, to a highlight group? Every match feature I have come across uses a regex pattern as input.
The reason I ask is because I am making a syntax coloring plugin that will make text an increasingly lighter shade of gray with increasing parenthesis depth. If vim has no such feature and another algorithm makes character-by-character highlighting unnecessary, please point me to it!
Vim has a whole set of special regular expression atoms that can specify buffer positions.
For lines, \%23l matches only in line 23. You can also use \%>23l for all lines starting from 23, and concatenate two of those with < and > to specify ranges.
For columns, there are the corresponding \%23c and \%23v. The former uses byte indices (what Vim somewhat confusingly calls "columns"), as returned by functions like col() and getpos(), the latter screen widths (from virtcol()).
By combining those atoms, you can select arbitrary blocks of text, and highlight them, e.g. with :call matchadd(...). See :help /\%l for details on the atoms.
For your plugin implementation, you may be able to get some ideas from the vim js context coloring plugin, which highlights JavaScript code according to its scope.

Vim -- Enumerate Lines in Base26

Is there any standard way to specify the set of characters that vim uses to enumerate lines? For example, instead of numbers in succession, could I use lower-case letters {a, b, ..., aa, ab, ac, ...} (or even better, use only the characters in a keyboard's home row) and still act on specific lines by this new referencing system?
I suppose an escape key of sorts -- perhaps ':' or 'g' -- might be needed, but even so, if anyone has suggestions as to how I could implement this, I'd be quite appreciative.
Thanks.
There's nothing built-in other than absolute and relative line numbers, and it would be difficult to square a different addressing scheme with the numerical [count] prefixes to the Vim motions. However, plugins like EasyMotion and vim-seek implement such, though for motions like the built-in f inside a line.
For implementation tips, have a look at the RltvNmbr.vim plugin; it uses the sign column to emulate the now built-in relative numbering. As the sign column is two characters wide (and can display arbitrary characters), this would be fitting. That would take care of the visualization... you'd then only need a custom mapping to query for the Base26 line number, and translate that back into a jump.

Make vim highlight python builtins when they are not followed by a dot

Is there a way to highlight built in Python functions in vim only when they are preceded by 1 more whitespaces? Furthermore, is there a modular way to do this? That is, I don't want to edit every single syn keyword pythonBuiltinFunc abs chr ... line, I just want to be able to say something like syn keyword pythonBuiltinFunc onlymatchafter="\s+"?
EDIT:
Here's an example, since the two people who answered my question didn't seem to understand what I was asking which is my fault for not being more clear.
When I write the following Python code
import numpy as np
x = np.abs(np.random.randn(10, 10))
The word abs gets highlighted simply because vim is essentially just matching anything that has the word abs in it that is not inside of a string. How can I get vim to highlight the Python builtins WITHOUT highlighting them when they are preceded by a dot?
The matched text of :syn keyword can only be comprised of keyword characters; though that set can be configured (:setlocal iskeyword=...), it would be foolish to include whitespace in there.
You have two options: Either re-write all keywords with :syn match (which can include whitespace), or make all keywords contained and define a :syn region that only starts after whitespace.
Both are rather huge interventions that basically mean you're (re-)writing your own Python syntax. You haven't told us why you'd want that... I'd say it's a bad idea.
Is the reason you want to do this because you want to remind yourself of using a consistent style in Python?
If so, I would like to recommend you adding the syntastic plugin. In combination with a tool such as flake8 it automatically detects and highlights any style errors you wish (by default PEP8 style violations), together with general syntax errors. I use this plugin a lot and highly recommend it.

Multiple matches for syntax highlighting in VIM

I'm writing a syntax file to match a log format (basically column based; think syslog for a similar example), and I'm trying to set up a type of inheritance for columns.
I have two main goals with this.
First, I want to say that column 3 is the "component" field (let's say it's marked by a header; it could also be at a fixed position) and set the background to, say, Grey. I then want to say that component "foo" gets a foreground color of Red, and component "bar" gets a foreground color of Green, but they should inherit the background color of the "component" column. In this case, the field should really have two syntax matches; this also makes it easy to conceal the entire column (a la Toggling the concealed attribute for a syntax highlight in VIM)
Second, there's a field for levels; I want to set the background of the entire line for a critical level message to Red, but the foreground should be continue to be set via the normal highlighting (component, source, etc; I left off most of the other requirements).
From what I can see in the vim documentation, this doesn't seem possible. Am I missing something? Alternatively, can anyone suggest a good workaround?
Thanks
You can't (yet). For each character, Vim only uses one particular highlight group, determined by the last, "most inner" non-transparent syntax group match.
To work around this, you need to define a combined highlight group and corresponding :syntax commands. Some syntaxes (e.g. $VIMRUNTIME/syntax/html.vim, and various Wiki formats) use that for combining bold, italic and underline, but it gets tedious and repetitive after that.
There's a patch proposed that would add a combine modifier for :syntax commands; it's in Bram's Todo list.

Resources