I have a restructured text enumerated list, which I export to HTML with rst2html:
#. My first point
#. My second, very important point
#. My third, very important point
#. My fourth point
I would like to highlight the second and third point, which are clearly very important. This is easily done with:
#. My first point
.. class:: red
#. My second, very important point
#. My third, very important point
#. My fourth point
However, this restarts the numbering (i.e. the second and forth point will be 1), while I want to continue on. Is it possible?
I have considered the inline role :red:`important point syntax, but it doesn't fit my scenario (it's a very long list of red points, and I don't want to add the inline role to each line).
This works for me:
#. My first point
.. class:: red
#. My second, very important point
#. My third, very important point
#. My fourth point
You can't set a class for the first item that way, though.
What about adding a class to each of the important list items?
<li class="important">Important</li>
and then styling it appropriately?
You can also use the nth-child selector, if you know which item should be highlighted
li:nth-child(2) {
color: red;
}
Related
Alt-left & Alt-right (the emacs key-bindings that work across many apps in Mac OS, including as I type now into chrome), instead of doing forward and back word, go forward and back form (i.e. lisp form).
This is a much higher level navigation, frustrating at first, but actually turns out quite usable because you can just bump one char into a form if you don't want to jump over it, then you can navigate by word within it just fine.
This is fine except within a comment line. There, the usual forward and back word break completely, simply jumping you back to the previous form (comment lines are ignored) or on to the next.
It would be great to be able to make cursive/intellij respect forward/back word within a comment line if possible but I have no idea how to modify this particular behaviour. It seems deeper than just modifying a key binding, if I'm correct.
It turns out these keys in cursive/intellij are bound by default as follows (note Alt-right is by default bound to both of the below):
and
The second was overriding the first, the one wanted here.
So by removing the alt binding to make it look like:
Plus the same for back, it now works as desired :)
I used custom renderer to display a Label as RichTextBlock. Using Paragraph, there is a TextIndentProperty to indent first line. However, I also need "Hanging Indentation" found in RichEditBox or SetIndent found in ITextParagraphFormat.
Is there a way to implemnent "Hanging Indentation" in RichTextBlock?
I have found the solution to this question.
Use left-padding to shift the entire paragraph in (say 10px)
Then, use text-indent with negative value to shift the first line of the paragraph out again (say -10px).
With this method, a hanging indentation can be achieved.
While reading arguments against the use of Tabs, I came across this (source):
...it can be a good idea to avoid tabs alltogether, because the semantics of tabs are not very well-defined in the computer world, and they can be displayed completely differently on different types of systems and editors.
I am relatively new to programming, and have never experienced any issues with tabs in my code, and I've used a number of editors including Notepad++, Programmer's Nodepad, Gedit, Kate, Sublime Text, etc. I may not have done enough coding to get to that point, hence the question:
Can someone please explain, in simple terms, what the quote states? And is the problem with tabs still relevant?
Please note that I am not asking you whether I should use tabs or spaces in my code. I am only after a rational explanation for a specific argument against tabs that I've come across.
I assume you want to see some examples so bellow I've listed some of the most common.
Problem #1: Tab width is not consistent
This is for "displayed completely differently on different types of systems and editors" part.
Even assuming all systems and editors (that your code will be displayed on) agrees on same tab semantics: "move to the right until the current column is a multiple of N", the N is arbitrary.
Historically "standard" for this N is 8 but now most people configure their editors it to be 4 or 2 to "look better".
This is where tab width inconsistency problems come from.
I will use tab widths 2 and 8 in my examples to make differences more visual but same applies to other widths as well.
Indent
Lets say someone is using tab width: 2 in their editor. They see the code like this:
class Foo:
def doSomething(a):
if test(a):
// some nice comment
// about this
bar(a)
Now someone else reads this code in say terminal that uses tab width 8. They see the code like this:
class Foo:
def doSomething(a):
if test(a):
// some nice comment
// about this
bar(a)
That someone may see this as not very pleasant.
Align
So far we have seen inconsistency in indent. But some people like to also align code e.g. assignments, comments.
Again with tab width 2:
class Foo:
def do_something(a):
if test(a):
foo = a.foo // some nice comment
foo_bar = bar(foo) // about this
bar(a)
Again someone else reads this in environment where tab width is 8. Lets say they need to post this snippet to the web and uses <pre> tag. Browsers by default use "standard" tab width 8 and the code looks like this:
class Foo:
def do_something(a):
if test(a):
foo = a.foo // some nice comment
foo_bar = bar(foo) // about this
bar(a)
They can't post it as is. They have to modify the code to replace tabs to spaces.
Line length
Most coding standards define maximum line width.
Lets take max line width 80 for example.
Someone using tab width 2 may see this code completely standard conforming. For them the longest line width is 74 (visible width as opposed to line length in bytes which is 72).
class Foo:
def do_something(a):
// Some very nice comment about code bellow using more then few words.
Someone else using tab width 8 (in a terminal for example) will see the same line as non-conforming because now longest line width is 86:
class Foo:
def do_something(a):
// Some very nice comment about code bellow using more then few words.
Since tab width is inconsistent, line with is now inconsistent too.
Problem #2: Tab is not same thing everywhere
This is for the "semantics of tabs are not very well-defined" part.
So far we assumed that everyone uses tab character as "move to the right until the current column is a multiple of N".
But in some contexts tab character may be used for something a bit different. For example in word processors tab means "move to the the next tab stop", where tab stops are completely arbitrary (and most likely not event the same width).
For example lets say someone is writing a document that uses tab stops:
Now lets say they need to paste some code snippet in it. If code is using tabs, following happens:
They can't leave it as is. They have to modify the code to replace tabs to spaces.
Conclusion
As you can see tabs in different contexts may render code from slightly to completely unreadable.
Spaces have none of the above problems.
I like #Giedrius’ answer (+1), and am going to toss in some vastly over-simplified history just because.
What is a space? It is a blank stretch between letters used to identify words.
How big is a space? It depends on the letters—specifically, on the font. There are thousands of fonts, and they can all be tagged as either proportional or non-proportional. In proportional fonts, character width varies (compare i and M); in non-proportional fonts, character width is always the same (compare i and M). How big is a space? It’s as big as whoever designed the font determined it should be. (Typesetting has been around since Guttenberg, which means the typesetting industry has had a few centuries to figure what works and what doesn’t.)
Skipping a few hundred hears, probably relevant stuff happened that I don’t know about.
Along comes the typewriter (hey kids, ever actually seen one?) These allowed you to type out anything you want to. However, to make it work (totally mechanical, all gears and pulleys, no electricity required, but not cool enough for Steampunk) every character has to be the same width, including the spaces.
Free-form words are all nice and well, but quite frequently people wanted to type up numbers in nicely formatted columns—such as for invoices, where you list items followed by their costs lined up by decimal point with a total at the bottom. (Can you imagine doing that by hand? Congratulations, you just imagined my summer job waaay back when. << Insert Liquid Paper reference here.>>) To make this feasible, someone came up with the TAB key. If you do X on the typewriter, it would remember that “hey, there’s a tab stop here”, and if you hit tab and had not yet reached that column on the row you were typing the print head would jump to that point. How big was it? You guessed it, it depended on what the user needed. (What "X" was totally depended on the typewriter manufacturer.)
Thus and so: no real-world correlation between tabs and spaces, unless there's something obscure from the linotype industry. On typewriters a tab stop would line up with a “regular” character position, whereas on computers there’s no such limitation.
I'm making a financial program with qt.
I just added a QDoubleSpinBox to my dialog, in this spin box the user must insert the price of some products, so I set the prefix to my currency symbol.
Now I wanted to ask if there's a way to put the prefix to left and the numbers to right.
The prefix is prepended to the start of the displayed value, suffix is appended to the end of the displayed value.
As you can see the prefix is indeed at the left of the numbers. Anyways why would you need to change the prefix position? If you need to append a string to the end of the value just change the suffix, not the prefix.
Or perhaps I didn't understand the question correctly. If what you need is to align the prefix to the left and the numbers to the right like this:
You can visually adjust it by adding tab characters at the end of the prefix.
e.g. doubleSpinBox->setPrefix(tr("[prefix]\t"));
I have a bulleted list in InDesign but I want the bullet character to be shown twice.
I'm using the / character, so I want it to appear like // like a comment. I can't figure it out. I have the bullet a different colour/style as the text following it, so I don't want to "hard-code" it in either.
Sorry for the trolls fellow. Your question isn't a programming question, which is why you got a downvote.
However, to help you out, try using a font for your bullet point that has a glyph that you like - you can use any character for the bullets, you know.
Or, if you create a new paragraph style, you can go into the Paragraph Style Options under Bullets and Numbering. Now, where it says Text After you can enter another bullet character there. But you'll have to also create a character style to set it to the right font to show your bullet character.