I'm trying to create this symbol in KaTex:
(I know there are the KaTex commands \xrightleftharpoons{} and \rightleftharpoons, but they make both arrows the same length.)
It's for an explanation of chemical equilibrium.
best I managed is putting an arrow over an arrow:
\begin{array}{c}
\scriptstyle exotherm\thinspace \thinspace \thinspace \thinspace\\
H_2O + H_2O \thinspace \overleftharpoon{\thinspace\thinspace{\scriptscriptstyle\rightharpoondown} \thinspace\thinspace} \thinspace H_3O^+ + OH^-\\s
\scriptstyle endotherm\thinspace \thinspace \thinspace \thinspace
\end{array}
renders as (on https://katex.org/):
The problem is, I have no idea how to make the long arrow be on the bottom.
Is there a way to do this?
The function \underleftharpoon{} does not exist in KaTex.
(I want to do this in KaTex, not MathJax)
Katex provides the mhchem extension to write chemical equations.
According to their documentation for reaction arrows mhchem provides a stretched arrow functionality.
$\ce{H2O + H2O <<=>[exotherm][sendotherm]H3O+ + OH-}$
results in the following output:
Hope this helps. Otherwise the solution in your comment seems promising.
Related
I've been transitioning to using VS Code for my python projects after previously working with the full Visual Studio, and some of the key bindings/features I'm used to in Visual Studio I can't find the equivalent for in VS Code. I'm not sure if the bindings are different or if the feature doesn't exist.
One feature in particular that I can't figure out is if it is possible to do multi-line select past line endings. In Visual Studio, using Alt + Click + Drag, lets you create a multi-line cursor or box selection, that can extend past line ends, implicitly adding spaces as needed so that the right-most side of the box stays uniform. In VS Code, if you drag the selection past the end of a line, the selection box won't go past the end of the line, even if other lines in the selection extend past it. In Visual Studio, this feature even goes further, as you could Alt + Click + Drag even in areas with no characters as all, creating a multiline cursor or box selection to the right of all existing line ends.
This isn't an essential feature, but it's very handy in making code easy to read. For example, when assigning several dictionary entries all at once, with varying key lengths. Is it possible to do something like this in VS Code?
Edit: The feature I'm looking for is virtual spaces (thank you Mark for providing the feature name), which seems to be an outstanding feature request in VS Code.
The short answer is no, vscode does not have a box select, past line ends, built-in. VS Code does not have the concept of virtual spaces which would be necessary to make this work yet.
Below is the issue, lots of comments, not that many upvotes. Upvote it.
https://github.com/microsoft/vscode/issues/5402
Having trouble finding a way to do this, maybe it is not even possible?
In my case, for testing flow of if-statements/user-interaction, am temporarily adding 40 lines of console.log('trigger-fired-1'); throughout our code.
However, to tell them apart would like each to end with a different number, so in this case, numbers one to forty like so:
In the screen recorded gif, to replicate what I am going for, all I did was copy/paste the numbers one to nine. What I really would like is a shortcut key to generate those numbers at the end for me to eliminate that step of typing out each unique number.
Am primarily coding in Visual Studio Code or Sublime Text, and in some cases shortcuts are similar, or at least have same support but for different shortcut keys.
There are a few extensions that allow you to do this:
Text Pastry
Increment Selection
NumberMonger
For Sublime Text, the solution to this problem is the internal Arithmetic command. Something similar may or may not be available in VS Code (possibly with an extension of some sort) but I'm not familiar enough with it to say for sure.
This command allows you to provide an expression of some sort to apply to all of the cursor locations and/or selected text.
By way of demonstration, here's the example you outlined above:
The expression you provide is evaluated once for every selection/caret in the buffer at the time, and the result of the expression is inserted into the buffer (or in the case of selected text, it replaces the selection). Note also that when you invoke this command from the input panel (as in the screen recording) the panel shows you a preview of what the expression output is going to be.
The special variable i references the selection number; selections are numbered starting at 0, so the expression i + 1 has the effect of inserting the selection numbers starting at 1 instead of 0.
The special variable x refers to the text in a particular selection instead. That allows you to select some text and then transform it based on your expression. An example would be to use x * 2 immediately after the above example (make sure all of the selections are still present and wrapping the numbers) to double everything.
You can use both variables at once if you like, as well as anything in the Python math library, for example math.sqrt(i) if you want some really esoteric logs.
The example above shows the command being selected from the command palette interactively, where the expression automatically defaults to the one that you want for your example (i + 1).
If you want to have this as a key binding, you can bind a key to the arithmetic command and provide the expression directly. For example:
{
"keys": ["super+a"],
"command": "arithmetic",
"args": {
"expr": "i+1"
},
},
Try this one ...
its not like sublime
but works g
https://github.com/kuone314/VSCodeExtensionInsertSequence
This is in the RubyMine IDE.
It seems really simple but I can't find a way to do it. I want to take a line
[:a, :b, :c]
and as part of the reformatting rearrange each value to one line like so:
[
:a,
:b,
:c
]
And assign a nice little keyboard shortcut.
Any idea how I do this? RubyMine documentation isn't great.
Not familiar with a way to use the IDE reformatter for this need.
But, you can achieve the rearrangement using the find an replace tool (CTRL + R).
Mark the regex checkbox.
In the find box look for space - ().
In the replace box, insert newline - \n\t.
Then hit Replace all - it should do most of the job.
http://www.dofactory.com/Patterns/PatternFlyweight.aspx
There is a UML diagram on that page. It has three different kinds of connections. The shared aggregation connection, the generalized connection (triangle arrow), and the other one... How do I get the other one in Visio? I can't find it...
Thanks.
It isn't "there". You need to specify the "Begin" and "End" shapes for your line, from the Format -> Line menu (or "More line ends" in the lines drop-down menu)
You can use this 1 legged connector
Adjusting the line formatting on arrows found in the shape libraries is buggy and tedious for me. I think the simplest to use arrow in Visio 2010 is on the ribbon Home > Tools > Connector. It's easy to modify it to look like any of the arrows that Michael referenced in his link.
I think you want the Dynamic Connector which, in the past, would appear as standard among the Basic Flowchart Shapes.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I use Netbeans (nightly build) for Ruby on Rails development and I'm looking to beef up my macros. I've created a few myself:
copy identifier:
select-identifier copy-to-clipboard
paste clipboard over identifier:
select-identifier paste-from-clipboard
double quote element
select-element-next "\""
single quote element:
select-element-next "'"
But I'm looking for other useful ones and Google is giving me nothing.
The record macro feature usually doesn't work too well so I'd rather just "write" the macros myself but I can't even find a reference that lists what commands (like "select-identifier") are actually available.
Any Netbeans macro gurus out there?
Here is a list of macro codes with short explanations. Might be useful for someone.
Update: replaced old link with one to the Netbeans site and included the macro list in here.
abbrev-debug-line Debug Filename and Line Number
adjust-caret-bottom Move Insertion Point to Bottom
adjust-caret-center Move Insertion Point to Center
adjust-caret-top Move Insertion Point to Top
adjust-window-bottom Scroll Insertion Point to Bottom
adjust-window-center Scroll Insertion Point to Center
adjust-window-top Scroll Insertion Point to Top
all-completion-show Show All Code Completion Popup
annotations-cycling Annotations Cycling
beep Beep
build-popup-menu Build Popup Menu
build-tool-tip Build Tool Tip
caret-backward Insertion Point Backward
caret-begin Insertion Point to Beginning of Document
caret-begin-line Insertion Point to Beginning of Text on Line
caret-begin-word Insertion Point to Beginning of Word
caret-down Insertion Point Down
caret-end Insertion Point to End of Document
caret-end-line Insertion Point to End of Line
caret-end-word Insertion Point to End of Word
caret-forward Insertion Point Forward
caret-line-first-column Insertion Point to Beginning of Line
caret-next-word caret-next-word
caret-previous-word caret-previous-word
caret-up Insertion Point Up
collapse-all-code-block-folds Collapse All Java Code
collapse-all-folds Collapse All
collapse-all-javadoc-folds Collapse All Javadoc
collapse-fold Collapse Fold
comment Comment
complete-line Complete Line
complete-line-newline Complete Line and Create New Line
completion-show Show Code Completion Popup
copy-selection-else-line-down Copy Selection else Line down
copy-selection-else-line-up Copy Selection else Line up
copy-to-clipboard Copy
cut-to-clipboard Cut
cut-to-line-begin Cut from Insertion Point to Line Begining
cut-to-line-end Cut from Insertion Point to Line End
default-typed Default Typed
delete-next Delete Next Character
delete-previous Delete Previous Character
documentation-show Show Documentation Popup
dump-view-hierarchy Dump View Hierarchy
expand-all-code-block-folds Expand All Java Code
expand-all-folds Expand All
expand-all-javadoc-folds Expand All Javadoc
expand-fold Expand Fold
fast-import Fast Import
find-next Find Next Occurrence
find-previous Find Previous Occurrence
find-selection Find Selection
first-non-white Go to First Non-whitespace Char
fix-imports Fix Imports
format Format
generate-code Insert Code
generate-fold-popup Generate Fold Popup
generate-goto-popup Generate Goto Popup
generate-gutter-popup Margin
goto Go to Line...
goto-declaration Go to Declaration
goto-help Go to Javadoc
goto-implementation Go to Implementation
goto-source Go to Source
goto-super-implementation Go to Super Implementation
in-place-refactoring Instant Rename
incremental-search-backward Incremental Search Backward
incremental-search-forward Incremental Search Forward
insert-break Insert Newline
insert-date-time Insert Current Date and Time
insert-tab Insert Tab
introduce-constant Introduce Constant...
introduce-field Introduce Field...
introduce-method Introduce Method...
introduce-variable Introduce Variable...
java-next-marked-occurrence Navigate to Next Occurrence
java-prev-marked-occurrence Navigate to Previous Occurrence
jump-list-last-edit Last edit
jump-list-next Forward
jump-list-prev Back
last-non-white Go to Last Non-whitespace Char
make-getter Replace Variable With its Getter
make-is Replace Variable With its is* Method
make-setter Replace Variable With its Setter
match-brace Insertion Point to Matching Brace
move-selection-else-line-down Move Selection else Line down
move-selection-else-line-up Move Selection else Line up
org.openide.actions.PopupAction Show Popup Menu
page-down Page Down
page-up Page Up
paste-formated Paste Formatted
paste-from-clipboard Paste
redo Redo
reindent-line Re-indent Current Line or Selection
remove-line Delete Line
remove-line-begin Delete Preceding Characters in Line
remove-selection Delete Selection
remove-tab Delete Tab
remove-trailing-spaces Remove Trailing Spaces
remove-word-next remove-word-next
remove-word-previous remove-word-previous
replace Replace
run-macro Run Macro
scroll-down Scroll Down
scroll-up Scroll Up
select-all Select All
select-element-next Select Next Element
select-element-previous Select Previous Element
select-identifier Select Identifier
select-line Select Line
select-next-parameter Select Next Parameter
select-word Select Word
selection-backward Extend Selection Backward
selection-begin Extend Selection to Beginning of Document
selection-begin-line Extend Selection to Beginning of Text on Line
selection-begin-word Extend Selection to Beginning of Word
selection-down Extend Selection Down
selection-end Extend Selection to End of Document
selection-end-line Extend Selection to End of Line
selection-end-word Extend Selection to End of Word
selection-first-non-white Extend Selection to First Non-whitespace Char
selection-forward Extend Selection Forward
selection-last-non-white Extend Selection to Last Non-whitespace Char
selection-line-first-column Extend Selection to Beginning of Line
selection-match-brace Extend Selection to Matching Brace
selection-next-word selection-next-word
selection-page-down Extend Selection to Next Page
selection-page-up Extend Selection to Previous Page
selection-previous-word selection-previous-word
selection-up Extend Selection Up
shift-line-left Shift Line Left
shift-line-right Shift Line Right
split-line Split Line
start-macro-recording Start Macro Recording
start-new-line Start New Line
stop-macro-recording Stop Macro Recording
switch-case Switch Case
to-lower-case To Lowercase
to-upper-case To Uppercase
toggle-case-identifier-begin Switch Capitalization of Identifier
toggle-comment Toggle Comment
toggle-highlight-search Toggle Highlight Search
toggle-line-numbers Toggle Line Numbers
toggle-non-printable-characters Toggle Non-printable Characters
toggle-toolbar Toggle Toolbar
toggle-typing-mode Toggle Typing Mode
tooltip-show Show Code Completion Tip Popup
uncomment Uncomment
undo Undo
word-match-next Next Matching Word
word-match-prev Previous Matching Word
I needed to surround text fragments with HTML tags, but couldn't figure out how to do it quickly, so I came up with this macro:
cut-to-clipboard "<strong>" paste-from-clipboard "</strong>"
Simple, clean, and you can put any tag/text you want. Give it a shortcut like Alt+B and you have quick way to insert HTML
for php add semicolon to end line ("complete line")
but keep your cursor at the current point,
so you can keep typing the rest of the line
split-line
caret-down
caret-end-line ";"
caret-begin-line
selection-begin-line remove-selection
delete-previous
This is my first netbeans macro.
"echo '< pre >';print_r();die();"
my shortcut key => Alt+A
for this you can use any shortcut
Oh well, just experimenting with netbeans.
I add a simple new macro for netbeans.
name: "scrollup_newline"
code:
insert-break
scroll-up
It works well, so every i press enter, the editor move one line down. This way i can code and have the caret in the middle of the editor.
This is for HTML. I just made:
caret-begin-line "<li>" caret-end-line "</li>" caret-down
Mapped it to ctrl+shift+L This is my first netbeans macro. Later maybe I can make it work for an entire selection somehow.
Edit: Can't figure out doing it for selections, but adding "caret-down" at the end was almost as good.
Here is the macro I wrote today. I am very much missing an "extract method" or "introduce method" refactoring in PHP, so I wrote this macro. I know this is far less complex than the refactorings in Java, but it can be used and it saves a few copy/pastes and writing repetitive code.
cut-to-clipboard
"$this->UNNAMED_METHOD();"
collapse-fold
caret-end-line caret-backward caret-end-line insert-break
"private function UNNAMED_METHOD() {"insert-break
paste-from-clipboard insert-break
This macro inserts -moz- and -webkit- prefixed equivalents of a css3 style rule:
caret-end-line selection-begin-line copy-to-clipboard caret-backward insert-break caret-up "-webkit-" paste-from-clipboard insert-break "-moz-" paste-from-clipboard
insert-date-time remove-word-previous remove-word-previous
Mapped to CTRL+SHIFT+D to insert the short date, so useful cause I like to date my comments / TODOs but often don't know the date!
Although I think Code Templates and more useful, for example:
// <editor-fold defaultstate="collapsed" desc="${cursor}">
and
// </editor-fold>
Mapped to 'fold' then tab and 'endfold' then tab respectively.
Also
JOptionPane.showMessageDialog(null, "${EXP default="Got here"}");
Mapped to 'jop' then tab is handy.
Probably not the most efficient but it helps me out lol
"(() ? : );"
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
caret-backward
As one can see, this is for PHP quick conditionals. This then places the cursor in the spot where you start typing the condition. Perfect no matter where your throwing it into. I put this to Ctrl+NUMPAD0 for quick typing access. I orignally had it to two TABs but that quickly got annoying haha
I often like to have commas as the first character separating properties or list items in JavaScript; like so:
var foo = {
a : 'a'
//, b : 'B' //todo: make lcase
, c : 'c'
};
Sometimes, I either forget to do this, or have a mass of text to update. To fix these quickly, I bound the keyboard shortcut C-, C-, -- That's two presses of ',' while holding CTRL key -- to:
caret-end-line selection-next-word selection-next-word " " caret-backward caret-backward insert-break
I found Code Templates to be very useful, especially this one (for HTML):
<${tag}>${cursor}</${tag}>
The abbreviation is "tt", and it can also surround any text with custom tag, when called by the code template menu.
<${param_name default="tag"}${cursor}>
${selection}
</${param_name default="tag"}>
This one will surround anything with any tag. Select something, then Alt+F3, then just select this template from the menu. After that type the tag you want, e.g. "div".
This is a code template for creating a static logger in a class using SLF4J. I tie it to "Log".
private static final ${loggerType type="org.slf4j.Logger" default="Logger" editable="false"} log = ${loggerFactoryType type="org.slf4j.LoggerFactory" default="LoggerFactory" editable="false"}.getLogger(${classType editable="false" currClassName default="getClass()"}.class);
This makes a log.debug line which I tie to "log":
log.debug("${message}", "${variables}");