(written from a Production point of view)
The following are Star Trek parodies and references in literature and comics.
3001: The Final Odyssey
In the fourth (and final) part of Arthur C. Clarke's Space Odyssey saga, Dr. Frank Poole (played by Gary Lockwood in the film version of 2001: A Space Odyssey) is revealed to be a Star Trek fan, asking autographs from Leonard Nimoy and Patrick Stewart as a teenager. When choosing 20th century television programs for him, 31st century scientists selected episodes from "all the four Star Trek series" (the novel was published in 1997, long before the debut of Star Trek: Enterprise).
Angels & Demons
In Dan Brown's predecessor to The Da Vinci Code, Robert Langdon comments that he has "sort of" heard of antimatter, to which Vitoria Vetra responds, "you watch Star Trek?" Langdon agrees and asks "isn't antimatter what powers the starship Enterprise?" Langdon later holds back from asking about "Captain Kirk using Photon torpedoes against the Klingons."
The sci-fi children's book series Animorphs features many references from Star Trek, like a character called the Ellimist, who is based off Q and the novel Flatland, an alien race called the Hawjabrans, who have freighters that look a little like the USS Enterprise-D, and the females of an alien race called the Ongachic, who look like Worf.
Some of the gang frequently played Star Trek: The Original Series, with Cutter John as James T. Kirk, Opus (and Steve Dallas briefly) as Spock, Portnoy as Montgomery Scott, and Hodge-Podge as Hikaru Sulu.
Over the years, DC comics artist have included multiple visual homages to Star Trek in their art. In the 1970s, one member of the Green Lantern Corps was recognizable as being a Vulcan.  In the 1990s, backgrounds in both "Legion of Super Heroes" and "Legionnaires" included recognizably Star Trek-inspired ships.
Dilbert is a popular newspaper comic featuring an engineer called Dilbert and satirizing corporate and office culture. There is also an animated series, which also features a number of Star Trek references. (documented here)
The comic for August 19, 1993 has a mind-reading Dogbert discovering that all the company employees care for are romance, ski trips and Star Trek. 
The comic for December 13, 1993 has a customer asking if a product will be capable of detecting Tachyon field emmisions. Dilbert notes that he's confusing the company with Star Trek again, but when a salesperson promises to include it in the next update, Dilbert thinks "Beam me up, Spock, ther's no life on this planet. 
The comic for July 25, 1994 has Dilbert remarking that it seems unnatural for him to have an actual girlfriend, because when the captain on Star Trek falls in love, the women always dies in an unlikely accident.
The comic for March 3, 1996 has Dilbert interviewing a potential new employee. When she looks right through his attempt to portray company culture in a positive light, he panics, his inner thoughts being "My shields are down... A hull breach is imminent". Later Wally also independently identifies Dilber's state as a hull breach.
The comic for October 9, 1996 has Dilbert saying "Resistance if futile. You will be assimilated."
The comic for January 15, 1997 sees Bill Gates' house comming to Dilbert's house yelling "prepare for assimilation" after he accidently agrees to be Bill Gates' towel boy by not reading a software licence. 
The comic for November 15, 1997 has Dogbert recalling a story in which Dilbert yelled "I'm an engineer, not a diamond cutter, dang it!". 
The comic for July 7, 2003 has Carol sarcastically responding to the request that she print out the company website and put it into a binder for easy reference that she will also translate it in Klingon to make it even easier. 
The comic for May 3, 2005 has a character asking Dilbert which of the Star Trek seasons he liked best. 
The comic for November 19, 2009 has Dilbert describing a consultant with pointed ears as a "Spock-eared sociopath". 
The Dresden Files
The Donald Duck story "Beam Me Up, Mr. Fargone" (D 97619), written by Kari Korhonen and drawn by Vicar) is a spoof of Star Trek, particularly the fandom, conventions and merchandise. The story is set in a science fiction convention. Some of the items sold at the convention include a wooden log labeled "Captain's Log" and a Vulcan ear labeled "Final Front Ear". The creator of the series lives in seclusion, and in a video shown in the convention, tells the interviewers to get a life.
Flow My Tears, the Policeman Said
The comic Foxtrot has made fun of Star Trek numerous times and the youngest member of the family, Jason, is an avid Trek fan.
General Protection Fault (GPF)
A web comic that pocks fun at the comic industry, Gutters has made a joke or two based on the Star Trek line of comics:
The Hardy Boys
Star Trek has been referenced numerous times in The Hardy Boys novel series, published by Simon & Schuster, the company behind the Star Trek novels. Most recently in The Hardy Boys Undercover Brothers #25 Double Trouble, where Joe Hardy sarcastically compares his older brother, Frank, to "Mr. Spock", and most notable in The Hardy Boys #172 Trouble in Warp Space, in which the Joe's girlfriend gets a walk-on part in a new TV series called Warp Space, an obvious reference to Star Trek: Enterprise.
The Hitchhiker's Guide to Star Trek, the Next Generation
The Hitchhiker's Guide to Star Trek, the Next Generation is an Internet cross of Star Trek and The Hitchhiker's Guide to the Galaxy. It was written by David T. Lu and Mickey McCarter. An HTML version of it was made available in 2011.
The House of Night (Marked)
Zoey, one of the main characters, admits to being a Star Trek fan, and had a Borg Invasion 4D hoodie.
I Love You, Beth Cooper
The webcomic Jump Leads has referenced Star Trek several times, from mention of a hypothetical "goatee-toutin' doppelgänger" in the first issue, "Training Day", to characters and locations named after actors involved with the production of the various shows, right up to the tenth issue, entitled "The Voyage Home", which features cover art that pays homage to the poster for the movie.
The Jungle: A Novel of the Oregon Files
MacD says that the Oregon's op center is reminiscent of the Enterprise and that Juan's chair in the middle of it is where Chris Pine sat, prompting Juan to realize he was too out-of-touch to know there'd been a new Trek movie.
The now-defunct Hungarian version of Mad Magazine featured a three-issue parody of Star Trek: The Next Generation, entitled Star Tok, in 1999. 
Least I Could Do
The web comic "Least I Could Do" makes various references to Star Trek, and all other manner of science fiction, throughout the series. These can be seen at their website or in the book collections.
- Make It Not
- Make It So
- Friendly Angel, Come to Me
- He's So... Human
- Gorn Injuries
- Picard Manouever
- Are Tribbles the same as Furries?
- Fruits or Vegetables
- Tears of a Rayne
- Make it so!
- Man the catapults!
- Imzadi Night Stand
- Make it so!!!
- This means something. This is important.
- Beeee goooood
- Give me tactical!
- I though we were sparring
Mad Magazine (#115, December 1967) had a parody of Star Trek called "Star Blecch!".  The title alteration followed two parodies of the films and spin-off series.  The October 1976 issue (#186) featured a musical parody called "Keep On Trekkin'", with Kirk, Spock and Alfred E. Neuman dancing on the cover ; thirty-five years later, in June 2011 (#509), that image would appear at the end of Dancing With The Star Wars (a Dancing with the Stars satire using Star Wars characters) advertising a similar Trek treatment the next week - but Kirk and Spock now have the faces of Chris Pine and Zachary Quinto, to which a senile-looking William Shatner, sitting in a motorized scooter onstage, takes great offense. Kirk appeared again, "green woman" in tow, in the very next issue (#510), one of many well-known "captains" (including Morgan, Sparrow, Kangaroo, Sullenberger and Ahab) to whom upcoming film subject Captain America is compared unfavorably; the character's likeness is once again that of TOS-era Shatner. The magazine will frequently insert Trek references into stories with Trek actors: for example, the beginning of the Samantha Who? parody in the May 2008 issue showed Tim Russ's character with Vulcan ears and a Starfleet combadge on his jacket (a later scene showed two Trekkies ogling the main character, played by Christina Applegate), while in a June 2003 parody of the X-Men film X2, Professor X (Patrick Stewart), asked how he could stand to be around so many "mutants", replies that, after enough Star Trek conventions, it was easy - or other science-fiction franchises: Worf, Quark, Odo and Morn could be seen in the background in various parts of a May 1995 X-Files parody, while the beginning of an April 1998 spoof of Alien Resurrection showed a group of famous sci-fi aliens concealed in pods behind the main characters: one of them is Spock, clearly looking in the direction of his mother. Mad has recognized Trek's contributions - on the cover of the November 2002 issue, celebrating the magazine's 50th Anniversary, the fifty different images used to create "5" and "0" include Alfred E. Neuman as a Vulcan (from the "Keep On Trekkin'" cover) and a Ferengi.
In the late 1970s and early 1980s, Marvel included Star Trek-inspired characters and artwork depicting members of the Shi Ar Empire, most notably "Captain K'rrk", commander of a multi-species crewed Shi Ar vessel. Their uniforms were depicted in the Trek service division (Command, Science, Operations)colors, using the original lime/olive green for Command. K'rrk, like his Trek inspiration, was promoted to admiral later in his career.
In the late 90s-early 2000s, another Shi Ar Captain was introduced as Captain P'crrd. In keeping with his namesake, he was bald.
After their introduction to the Shi Ar, the X-Men incorporated "hard light" technology into their Danger Room training environment, rendering it functionally equivalent to a holodeck.
The Megatokyo comic 1337 has a reference to redshirts.
My Little Pony: Friendship is Magic (IDW Comics)
In Issue #2, Pinkie Pie finds a pony skull in the Appleloosan Mountains and it names it "Mr. Bones", due to the skull having Leonard McCoy's hair style.
In Issue #9, Princess Luna's shapeshifting t-shirt gains an starfleet emblem during the race event with Big Macintosh.
In Issue #10, there are some ponies that resemble James T. Kirk and Spock, a gray pony that resembles Bilar tells them, "Joy to you friends! Come for the festival are ya?", this is a reference to the episode: The Return of the Archons.
In Issue #11, in the basement were Shining Armor plays a game similar to Dungeons & Dragons with his friends, there is a poster that has Constitution class refit, possible the USS Enterprise (NCC-1701) and the tittle is "Star Trot II" this is an obviously reference to Star Trek II: The Wrath of Khan
Night of the Living Trekkies
Omicron Ceti III
The satirical newspaper The Onion frequently makes references to Star Trek. One of its recurring columnists, an obnoxious sci-fi fan named Larry Groznic, sometimes mentions the franchise - in addition to occasionally mentioning meetings with Trek actors such as John de Lancie and Marc Alaimo , he boasts in the October 15, 2001 issue of writing a crossover with Back to the Future in which Doc and Marty secretly assist Kirk and Spock in Star Trek IV: The Voyage Home  (evidently forgetting the resemblance Doc bears to someone of Kirk's acquaintance), while in the April 10, 2003 issue, in harshly criticizing someone for his decision not to learn Elvish, he wonders if that person would even bother to learn a language as simple and inelegant as Klingonese . The paper has also made light of Barack Obama's well-known status as a Trek fan - three weeks after the release of Star Trek (a video on its website showed a faux newscast  in which numerous Trekkies leave the theater with harsh words for the "fun, watchable" film) the front page of the May 26, 2009 issue included a picture  of Obama giving a press conference with fake Vulcan ears, with "Obama Addresses Nation Still Wearing Spock Ears" in a caption below, while in the December 9, 2009 issue, amid the uproar following the uninvited presence of a Virginia couple's at a state dinner, an "infographic"  revealed numerous other White House security breaches, including the accessing of sensitive information by thousands of people; this was blamed on the fact that Obama's passowrd, "NCC-1701", was not a terribly difficult one to crack.
Pale Kings and Princes by Robert B. Parker
The web comic Penny Arcade make various references to Star Trek throughout the series. These can be seen at their website, or in their book collections.
In the second chapter of the manga The Electric Tale of Pikachu, a loose adaptation of the animated series, Ash mentions that his Pikachu's name is "Jean-Luc Pikachu". Pikachu is also seen to be wearing a Starfleet combadge in the panel in question.
The web comic Player vs. Player make various references to Star Trek, most notably Star Trek: The Original Series, throughout the series. These can be seen at their website, or in their book collections, of which book five is titled "Treks On".
The Universal Union, Space Fleet, Captain Lucius Abernathy, Q'eeng, Anatoly Kerensky, Chief Medical Officer Hanson, and Chief Engineer West are all parallels of the United Federation of Planets, Starfleet, James T. Kirk, Spock, Pavel Chekov, Leonard McCoy and Montgomery Scott. When explaining why their lives are so dangerous, Jenkins puts up a picture of the Enterprise and says that they're living in a poorly-written TOS knockoff. Upon Time-travelling back to 2012 Los Angeles, Brian Abnett says to Duvall that somebody has to be the redshirt.
During a book signing at the Burbank Public Library, the author and Wil acted out a sketch in which Wil is a labor lawyer with the firm of Koenig, Nichols and Montalban suing the Universal Union over all the redshirt deaths, including how a deliberately unidentified captain was allowing a child to fly the ship.
Serge A. Storms novels of Tim Dorsey
The Big Bamboo
When Elves Attack
Sev Trek by John Cook, is a web comic parody of Star Trek (as well as many other popular sci-fi shows) from The Original Series to Enterprise. It even spawned a computer animated "episode" of Sev Trek: TNG.
Shatnerquake is a novel by noted bizarro fiction author Jeff Burk. The story involves actor William Shatner being trapped at a convention at which he is forced into mortal combat against all the characters he has ever played, including multiple versions of James T. Kirk.
The Short-Timers by Gustav Hasford
Sonic the Hedgehog Comic Book Series
In the Knuckles the Echidna and Sonic the Hedgehog comic book series' produced by Archie Comics, the Echidna character Moonwatcher can be seen wearing a uniform that closely resembles the operations division TNG Starfleet uniforms. Furthermore, with the VISOR-like device over his eyes, he is quite similar in appearance to Geordi La Forge.
The pre-refit USS Enterprise also made a cameo appearance in the (non-canon) Star Wars comic A Death Star is Born. Also, in the comic book adaptation for the Star Wars novel "Dark Force Rising," a boy on the planet Jomark can be seen holding a model of the Enterprise (Kirk, Spock, and McCoy are also in the frame).
A series of sci-fi novels by David Gerrold about a hard-luck starship in the middle of an interstellar war also intended to be a TV series at one point.
The Middle of Nowhere
Blood and Fire
A reworking of a Star Trek: The Next Generation episode rejected due to overarching homosexual thematics and an AIDS metaphor.
The new captain of the Star Wolf is said to have been previously posted on "The Big E," which is also said can't be risked on the front lines due to potential loss of morale if she's destroyed. A dead crewmember found on the Norway is named "M. Okuda."
Star Wreck: The Generation Gap
This mass-market paperback was first released in 1990. It is a tongue-in-cheek parody of the Trek universe, written by Wisconsin native Leah Rewolinski, with illustrations by Harry Trumbore. Six sequels followed. The books mainly center upon spoofs of the TOS and TNG series, with books six and seven spoofing DS9 as well.
The seven released titles in the series were:
- Star Wreck: The Generation Gap (1990)
- Star Wreck II: The Attack of the Jargonites (1992)
- Star Wreck III: Time Warped: A Parody - Then, Now and Forever (1992)
- Star Wreck IV: Live Long and Profit : A Collection of Cosmic Capers (1993)
- Star Wreck V: The Undiscovered Nursing Home (1993)
- Star Wreck 6: Geek Space Nine (1994)
- Star Wreck 7: Space the Fido Frontier (1994)
In the first issue of this comic book, a few visual references to Star Trek are made. A computer displays a LCARS interface, and later the uniforms of the Techo-pre-school have a remarkable resemblence to original series uniforms.
The War Against The Chtorr
A Day For Damnation
The webcomic xkcd is well-known for it's references to geek culture, so it should come at no suprise that it has referenced Star Trek on a number of occasions.
"Quantum Teleportation"  has a researcher lamenting that that the press always connects quantum teleportation research to the transporter from Star Trek, and then always write the same disappointed story when they find out it's not the same thing.
"Numbers"  charts the number of google results for certain phrases with certain numbers inserted (for example; I'm <x> and have never had a boyfriend"). Amongst the sentences charted is, "There are <x> lights", referencing the famous scene from "Chain of Command, Part II".
"Interstellar Memes"  charts how far certain memes would have traveled given "speed-of-light delay". According to the comic, "Live long and prosper" might have made it to HD 211415 by now, while "Resistance is futile" would have reached Vega.
Y The Last Man
In issue #27, Yorick and Agent 355 walk in the street of San Francisco. Yorick comments that the city doesn't completely suck and says that it's no wonder that the Federation of Planets choose it as its HQ location. Agent 355 doesn't understand his comment, and thinks that it's a Star Wars reference.
The September 28, 2011, edition of the Ziggy comic strip involves a transporter mishap, with a request to Scotty for assistance being heard coming from Ziggy's toilet.