Sign up ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Google docs has a nice set of styles such as normal text and header 1.

How do I add my own? I want to add a style called "code" for text that is programming code.

share|improve this question
Exactly why I came to this question. :) I just wanted to make a style called Code and Inline code that wouldn't be paragraph style. –  Robert Koritnik Oct 9 '13 at 13:58
I know the answer but I cannot add it because I don't have enough reputation. Basically you can utilize the Google Apps Scripts, here is what I did: In order to enable it you need to create a new script: Tools >> Script Manager >> New and paste the code there. Then you will have to authorize the script and reload the document so that the menu appears on in the menu bar. Then select a patch of text and pick Extras >> Apply code style –  Aleksey Bykov Nov 5 '13 at 5:46
I know my answer but my 101 reputation is, apparently, not enough. As of 3/14', once you update the existing headers via "Update Heading X to match", GDocs will add an additional Heading Y. So, it starts with just Heading 1,2,3, but once you update Heading 3, GDocs will introduce Heading 4. Once you update Heading 4, GDocs will introduce Heading 5, etc. –  JJ Rohrer Mar 3 '14 at 15:29
thanks @AlekseyBykov, I used your script and works flawlessly. –  Ivan Ferrer Villa Oct 28 '14 at 14:30
There's an Extension that does it:… (I can't post an answer because of a bug in stackexchange - it says I need 10 rep to answer, I've got 103 rep, no Answer box avail.) –  Chris Moschini Jul 21 at 14:52

4 Answers 4

up vote 57 down vote accepted

Right now it's not possible to add more styles or rename the existed ones, but you can modify them to match your needs.

For example you could style your code as you wish and then by selecting one of the headers and choosing the Update Heading # to match selection, that particular style could become your new "Code" style.

Then select something else and apply that heading and you're done.

Styles in google docs

share|improve this answer
downside is this will include "code" in my TOC. :/ I found that using Subtitle style for code prevents it from showing in TOC. –  digger69 Jul 30 '12 at 23:40
+1 @digger69 for that tip. Using “Subtitle” for code is the single best tip I've ever gotten from this StackExchange. Great for having line-height 1.15 throughout the document, but 1.0 for code! :D –  ELLIOTTCABLE Jun 18 '13 at 15:35
@digger69 +1 for the tip! –  bvukelic Apr 24 '14 at 15:26
As I also mentioned in digger69's answer, another downside is that this does not allow for inline styles; it has to be on its own line. Of course, short code, or more likely, code-related terms (such as tag, function or variable names) often want to live inline within a paragraph of text. –  Drewdavid Nov 7 '14 at 17:56

As Lipis poins out, you still cannot create your own styles. So, you are left to repurpose an existing one. The downside to using Heading is this will result in "code" in my TOC. :/ I found that using Subtitle style for code prevents it from showing in TOC.

share|improve this answer
The main downside of this approach is that while you can use ⌘+Alt+6 to use this layout if you override 6'th heading, there is no matching keyboard shortcut for the Subtitle style. –  Amit Kotlovski Jun 14 '14 at 10:08
The other note is that this doesn't seem to work inline, has to be on its own line (true of all styles I imagine) –  Drewdavid Nov 7 '14 at 17:54

Until recently, it was possible to edit the CSS (stylesheet) and HTML source of a document. It took some work, but if you knew HTML and CSS you could add a CSS class to your doc, and then edit the HTML to use it, e.g. in the HTML

<span class='booktitle'>Infinite Jest</span>

and in the CSS

.booktitle { font-style:italic; }

Google has more or less phased out this capability with their new format, forcing old docs to the new format. But, I've heard there are ways to keep docs in the old format, so there may be some hope.

share|improve this answer
I would love more info about how to do this. –  Stew Sep 21 '12 at 16:38
Doesnt work, google now strips all css except inlines –  vs4vijay Jun 13 '13 at 7:16

The gratis Google Docs extension Paragraph Styles+ allows to create custom paragraph styles (plus decimal system outline numbering for headings and a table of contents with page numbering).

I just tested it, and here's my first impression:

  • Good start. For small-ish documents, it should be good to use :-)
  • However it runs quite slow, even though recent versions improved on the performance already.
  • The UI does not integrate with the Google Docs style UI. Probably not possible otherwise in the Google Docs API.
  • The original Google Docs style feature does not know about custom styles, considering all text with custom styles as having the "Normal text" format. You can use both in parallel, but note that the "Clear formatting" button (looks like "Tx") will remove custom style formatting from selected text.
  • It seems to store your character styles on an external web service, means you have to entrust them access to your documents the way you entrust them to Google now …

Source: Acknowledging the comment by Chris Moschini above, who mentioned it first.

share|improve this answer
Are there any data security risks involved with installing this kind of docs extension, or has the code been verified by Google to be non-malicious? –  Gruber Aug 19 at 7:42

protected by Community Jul 16 '13 at 7:17

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.