question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removing Text Formatting: Bold/Italics/Underscore

See original GitHub issue

Great plugin, by the way. I love being able to use my idea keybinds 😃

I was hoping you could provide some insight on a great way to quickly bold/italic/underscore text in a tex doc.

What I have done

I wrote a Live Template that does this 20% of the way to where I want it. I wrote the following template(s):

\textbf{$SELECTION$}$END$
\textit{$SELECTION$}$END$
\underscore{$SELECTION$}$END$

These work as advertised. They surround the current selection with the appropriate command and then move the cursor to the end for consistent behavior. Not sure if I like it yet, we shall see about that.

To expand these the following commands on windows keystrokes are required: ctrl + alt + t i/b/u (pick your poison).

What i would like

In a perfect world, I would love to be able to ctrl + i/b/u, and have IDEA follow some predictable behavior to apply and\or remove the requested formatting.

Realistically, I would love to just use fewer keystrokes to only apply the format, and manually remove it as needed. Maybe ctrl + b to add, ctrl + shift + b to remove?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
PHPiratescommented, Nov 3, 2022

Good point, it does work but it is a little too strict in what it accepts. I think it would be better to replace .takeIf { it >= 0 } by .coerceAtLeast(0) in Clipboard:17 and handle failures later on.

If you change that, you can even paste tables like these ones: https://en.wikipedia.org/wiki/Prime_number#Primality_testing_versus_primality_proving

1reaction
PHPiratescommented, Oct 24, 2022

Probably would not do the trick since the correct answer would be

It would do the trick in the most simple case, but of course you can make it as complicated as you want, you can always find infinitely more cases in which it won’t work. That’s why I usually start with a very simple implementation, and if it turns out people are actually using it and requesting more advanced functionality I will expand it.

On a second note, would it be possible to take what the user pasted, and change all italics to \textit and bolds to textbf ?

Good question, if it is it might be similar to our TablePasteProvider which converts an html table in the clipboard into a LaTeX table.

That would be great! Let me know if you need any help, for example to get started or if you cannot find certain functionality.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reset Text Formatting (Bold, Italics, Strikethrough and ...
To reset text formatting to default press Ctrl Shift Y (Mac: Command Shift Y). This keyboard shortcut resets: Faux Bold, Faux Italic, All...
Read more >
Word 2000: Bold, Italics, Underline, and Format Painter
To change the type style of text: · Click the Bold button on the Formatting toolbar (Ctrl+B). · Click the Italic button on...
Read more >
Bold, Italics, Underline | Computer Applications for Managers
Applying the formatting twice removes the formatting. For example, selecting bolded text and then clicking the Bold button will remove the bold formatting....
Read more >
Clear all text formatting - Microsoft Support
Clear all formatting such as bold, underline, or italics and return your document to its default styles.
Read more >
Bold, italics and underlining - Overleaf, Online LaTeX Editor
Using italics, bold or underlined words can change the perception of the reader. In this article three basic text formatting tools will be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found