Skip to content

Instantly share code, notes, and snippets.

@opencoca
Forked from pdparker/APAstyle
Created September 18, 2022 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opencoca/9e43cdec34abde72bf8212da9084b0ce to your computer and use it in GitHub Desktop.
Save opencoca/9e43cdec34abde72bf8212da9084b0ce to your computer and use it in GitHub Desktop.
APA Style for Markdown
/* I have only tested this on Chrome but it
prints nicely to A4 size */
@media print {
body {
width: 210mm;
height: 297mm;
}
}
p,h1,h2,h3,h4,td,th{
font-family: Times New Roman;
font-size: 12pt;
color: #000000;
}
/* Use this div for the title page
For the abstract use quote with class long (see below)
*/
.title {
padding-top: 25px;
padding-bottom: 50px;
border-bottom: 1.5px solid black;
}
.title h1 {
font-size: 16pt;
text-align: center;
font-weight: bold;
}
.title h2 {
font-size: 12pt;
text-align: center;
font-style: italic;
}
.title h3 {
font-size: 12pt;
text-align: center;
font-style: italic;
}
.title h4 {
font-size: 12pt;
text-align: right;
padding-bottom: 50px;
}
title p {
font-size: 12pt;
text-align: left;
}
h1 {
font-size: 12pt;
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
font-weight: bold;
}
h2 {
font-size: 12pt;
text-align: left;
font-weight: bold;
}
h3 {
font-size: 12pt;
text-align: left;
font-style: italic;
}
.apaTable {
border-top: 2px solid black;
border-bottom: 1px solid black;
}
.apaTable th{
text-align: center;
padding-right: 15px;
padding-left: 15px;
border-bottom:1px solid black;
}
.apaTable td{
text-align: center;
padding-right: 15px;
padding-left: 15px;
}
.apaTable caption {
color: black;
font-size: 12pt;
font-family: Times New Roman;
}
.long {
text-indent: 40;
text-align: justify;
display:inline-block;
margin-left:2em;
margin-right:2em;
}
.short {
font-style: italic;
}
/* APA references come from https://github.com/bertobox/CSS-for-APA-Style-references */
@media all {
.apa, .apa ul, .apa ol, .apa dl,
.ref-apa, .ref-apa ul, .ref-apa ol, .ref-apa dl,
.apa-ref, .apa-ref ul, .apa-ref ol, .apa-ref dl,
.refapa, .refapa ul, .refapa ol, .refapa dl,
.aparef, .aparef ul, .aparef ol, .aparef dl{
padding-left: 0;margin-left: 0;
font-family: Times New Roman;
}
.apa li,
.ref-apa li,
.refapa li,
.apa-ref li,
.aparef li{
list-style-type: none;
}
.apa p, .apa li, .apa dd,
.ref-apa p, .ref-apa li, .ref-apa dd,
.refapa p, .refapa li, .refapa dd,
.apa-ref p, .apa-ref li, .apa-ref dd,
.aparef p, .aparef li, .aparef dd{
margin-left: 2em;
text-indent: -2em;
margin-top: 1em;
margin-bottom: 1em;
}
.ref-apa dt{
font-size: 1.5em;
font-weight: bold;
margin: .83em 0;
font-family: Times New Roman;
}
}
@media print {
.apa p, .apa li, .apa dd,
.ref-apa p, .ref-apa li, .ref-apa dd,
.refapa p, .refapa li, .refapa dd,
.apa-ref p, .apa-ref li, .apa-ref dd,
.aparef p, .aparef li, .aparef dd{
margin-left: .5in;
text-indent: -.5in;
margin-top: 1em;
margin-bottom: 1em;
}
}
/*
CSS for APA-Style Reference lists,
COPY THE FOLLOWING STYLES INTO YOUR CSS:
*/
/*
Sets any enclosing element (div/ul/ol/dl) with or within the following classes flush left
*/
.apa, .apa ul, .apa ol, .apa dl,
.ref-apa, .ref-apa ul, .ref-apa ol, .ref-apa dl,
.apa-ref, .apa-ref ul, .apa-ref ol, .apa-ref dl,
.refapa, .refapa ul, .refapa ol, .refapa dl,
.aparef, .aparef ul, .aparef ol, .aparef dl{
padding-left: 0;margin-left: 0;
font-family: Times New Roman;
}
/*
Disables bullets or numbers from appearing on references that use list item (li) elements
*/
.apa li,
.ref-apa li,
.refapa li,
.apa-ref li,
.aparef li{
list-style-type: none;
}
/*
Creates the hanging indent and the ‘double spacing’ between references.
*/
.apa p, .apa li, .apa dd,
.ref-apa p, .ref-apa li, .ref-apa dd,
.refapa p, .refapa li, .refapa dd,
.apa-ref p, .apa-ref li, .apa-ref dd,
.aparef p, .aparef li, .aparef dd{
margin-left: .5in; /*this controls how much to indent the lines in your reference. */
text-indent: -.5in; /*to start the first line flush to the left, express in negative here whatever distance you placed in the margin-left setting above. */
margin-left: 2em; /*this controls how much to indent the lines in your reference. */
text-indent: -2em; /*to start the first line flush to the left, express in negative here whatever distance you placed in the margin-left setting above. */
margin-top: 1em;
margin-bottom: 1em;
}
/*
The following items are OPTIONAL - Please READ:
DEFINITION TERM styling:
This is usually not needed for blogs
or if you’re already styling your <dt> tags elsewhere.
Tip: Style this element by applying what you are using for your <h2> tags
(or whatever style you feel best represents this hierarchy)
elsewhere in your document,
some generic initial settings are provided below:
*/
.ref-apa dt{
font-size: 1.5em;
font-weight: bold;
margin: .83em 0;
font-family: Times New Roman;
}
/* .ref-apa dd{margin-left: 0;}*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment