Frequently asked questions - Writer

From The Document Foundation Wiki
< Faq‎ | Writer
Jump to navigation Jump to search
Other languages:
Deutsch • ‎English • ‎dansk • ‎español • ‎français • ‎italiano

How to allocate a keyboard shortcut to a special character

The menu Tools ▸ Customise ▸ [tab] Keyboard allows you to allocate a shortcut only to the actual launching of the Insert ▸ Special Character command.

There are however three different ways to obtain the desired result.

Using AutoCorrection

  1. go to Tools ▸ AutoCorrect Options;
  2. enter in the Replace box the characters that you want to replace by the special character; and
  3. right-click in the With box, then choose Special character and select the character you want (it is also possible to paste this character in if it is present on the clipboard).

Note: AutoCorrection requires that the text to be replaced be "isolated" by preceding and following spaces at the time of capture.

Creation of an AutoText

  1. insert the special character into a document
  2. select the character and go to Tools ▸ AutoText
  3. choose the category in which the AutoText will be stored (My AutoText for example)
  4. give it a name and a shortcut
  5. click on the AutoText button followed by New and
  6. close the dialog

Note: As with AutoCorrection, the capture of the "shortcut" should in principle be preceded and followed by spaces in order that the code be recognised. AutoText however permits this limitation to be overridden by selecting the shortcut before hitting the F3 key (cf. the note in this FAQ).

Using a macro

It is possible to record the insertion of a character in a macro (menu Tools ▸ Macros ▸ Record macro) without requiring any particular knowledge of programming.[1]. Then allocate the macro to the keyboard shortcut concerned.

The advantages of this solution of allocating a macro to a keyboard shortcut are:

  • the insertion is effectively bound to the shortcut: it is not necessary to insert "replacement" text (AutoCorrection or AutoText); and
  • the shortcut can be defined for several modules.

Example of a recorded macro:

sub InsertCharSpec
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("")
rem ----------------------------------------------------------------------
dim args1(1) as new
args1(0).Name = "Symbols"
args1(0).Value = "©"
args1(1).Name = "FontName"
args1(1).Value = "Times New Roman"

dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args1())

end sub


  1. If this command is not available, you will need to activate it by using Tools ▸ Options ▸ LibreOffice ▸ General ▸ Enable experimental (unstable) features or from version 4 by Tools ▸ Options ▸ LibreOffice ▸ Advanced