Take the 2-minute tour ×
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: pastebin.com/4pNBJ9pC. 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

3 Answers 3

up vote 47 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

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.