txt2TeX, a simple word processor Eric Forgeot %!target: tex %!options(tex): -no--toc --outfile sample_eng.tex %--!target: xhtml %!options(xhtml): --toc --outfile sample_eng.html %!style(xhtml): sample.css %% DEF PERSONNAL STYLE (it should have a name such as sample.sty in your folder) %!style(tex): sample %% DEF TXT2TEX %!includeconf(tex): ../txt2tex.t2t %!style(tex): ../txt2tex %% DEF additionnal macros (can be removed) %!--preproc(tex): "$" '\n\n' %(this one is not activated. It's supposed to replace single line break by a real line break, which is not activated by default in txt2tags) %% DEF CUSTOM PACKAGE (if needed) % @@@ADDITIONALOPTIONS@@@ @@@SPECIALFONT@@@ %%%% Beginning of YOUR document %%%% = Manual = == Presentation == The txt2TeX was made because of our consideration for the good and appealing quality of the LaTeX output, and also because of our love for the simplicity of [txt2tags http://txt2tags.sf.net]. But there is also much frustration with LaTeX, it's perfect for writing scientific and complex books, but there is not way to quickly start writing prosa with it, without enduring the intrusive and complex syntax. The goal of txt2TeX is to use txt2tags as a preprocesseur, and keep its non-distracting formating marks, while being able to export easily into LaTeX and html. Txt2tags can already export to LaTeX, but there is little control on the output. By default, txt2TeX will have all that is needed to writing a simple and nice looking book or roman: Page numbering, top header with title and separating line, support for footnotes. //Note: Sorry for the quick and dirty translation of the French manual// == Getting txt2tex == For the internet html version, the archive is located [there ../txt2tex.zip]. For the others (pdf version), they can get this archive (txt2tex.zip) from http://anamnese.online.fr/site2/txt2tex/ == Prerequisite == LaTeX and python must be installed on your computer. Txt2TeX has been tested on those operating system : *-*- - Linux (Archlinux and Mandriva, others should work as well) + [TeXlive http://www.tug.org/texlive/] - MS Windows + [MiKTeX http://miktex.org/] *-*- You can use 'make' in addition (optional makefile), and postscript tools as well (pstopdf, psutils (pdfnup, psbook), pdfjam etc) == Use == The two files txt2tex.t2t et txt2tex.sty are the definition and the style of the system. Normally, you shouldn't have to modify those files. For getting started with a new document, just make a copy of the sample_en.sty under a new name (your personnal style for your document), and copy the header of the sample_en.t2t, also under a new name, if possible the same as your new style, until the mark %%%% Beginning of YOUR document %%%% in the source. *-*- Then, you just have to write your document and modify the basic appearance in the style file (margins, header, etc.). You can easily alter the size of paper, the size and name of the font, the size of the displayed text (implicitly defining the margins then). The syntax, which is quite easy to use, is described later. *-*- In order to compile your html or pdf document, on an unix system, open a terminal in the folder of your document, modify in the makefile the line with DOCUMENT = sample_en to suit your own document name and type either: - make html to generate a html page. - make pdf to generate a LaTeX document and then a pdf file. If the compilation goes well, there won't be any error written, and it should end with "entering extended mode". - make pdfsmall for making a document with 2 pages in one (needs pdfjam, and the links won't be activated anymore: good for printing only) - make booklet for making a recto-verso leaflet (needs psutils, links won't be activated anymore). The colums are not well aligned at the moment. - make epub pour creating an epub file (electronic e-book), needs the free software [calibre http://calibre.kovidgoyal.net/] to make the conversion from the html file. - make clean to clean the folder from temporary files. - make cleanall to clean the folder from temporary files, and erase every generated .tex and .pdf (needs a confirmation for security) - make all for making html, pdf, and clean temporary files. The sample.css file is an example of html style for your documents. == Syntax == The general systax is the one of txt2tags, and we added those symbols : *-*- - An initial is made with the symbol SYMBlettrine before the first letter of the word. - A small space between 2 sections is made with SYMBbigskip (quick to type on the numpad) - A bigger paragraph is made with SYMBparag (add a little leaf @@ding((166))**) - The end of a section with 3 stars in triangle is made with SYMBtroisetoiles - You can also have those symbols (centered and on a new line) : - moon first quarter : SYMBlunep - moon last quarter : SYMBluned - sun @@sun** : SYMBsoleil *-*- - Footnotes are possible if you wrap those notes with °° (see example below and the source code of this document for further examples). *-*- Even if you're not supposed to, you can add specific LaTeX code by replacing the \ by @@ and the { et } by ( ( and ) ) (without space). If you wish the command to disappear from the html output, you have to end your command with 2 stars ** to indicate the end of the code. You can also, more easily, surround your LaTeX code with the txt2tags syntax for verbatim (three `) *-*- The source code of this document will gave you more example on how to add more latex options in your text. For example this mathematic formula (which won't appear in the html version) : @@begin((displaymath))** @@frac((a))((b)) + @@sqrt[n]((abcd))** @@end((displaymath))** The verbatim version: ``` \begin{displaymath} \frac{a}{b} + \sqrt[n]{abcd} \end{displaymath} ``` A simple box: @@Ovalbox((Example of text in the box)) *-*- This last example will appear odd (on purpose) in the html version because there is no ** at the end of this special command. *--* Footnote examples: We can include footnotes this way@@footnote((Test of footnot))** (version with replacing code) Beware, this way footnotes won't appear in the html version@@footnote((This note will be lost in html.))** It's better to use this simpler form for keeping notes in the html version°°This note will be kept in the html version of the document°° *-*- = Sample texts = //Here are some examples of document for txt2TeX...// == A few sentences with various spacings == -**-Fjölnir sonur Yngvifreys réð þá fyrir Svíum og Uppsalaauð. Hann var ríkur og ársæll og friðsæll. Þá var Frið-Fróði að Hleiðru. Þeirra í millum var heimboð og vingan. Þá er Fjölnir fór til Fróða á Selund þá var þar fyrir búin mikil veisla og boðið til víða um lönd. *-*- Fróði átti mikinn húsabæ. Þar var gert ker mikið margra alna hátt og okað með stórum timburstokkum. Það stóð í undirskemmu en loft var yfir uppi og opið gólfþilið svo að þar var niður hellt leginum en kerið blandið fullt mjaðar. Þar var drykkur furðu sterkur. Um kveldið var Fjölni fylgt til herbergis í hið næsta loft og hans sveit með honum. *-*- Um nóttina gekk hann út í svalar að leita sér staðar. Var hann svefnær og dauðadrukkinn. En er hann snerist aftur til herbergis þá gekk hann fram eftir svölunum og til annarra loftdura og þar inn, missti þá fótum og féll í mjaðarkerið og týndist þar. *--* Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. *-*- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. *--* Persian or chinease poetry won't be displayed in pdf (unicode is a work in progress but should require xetex), but it's working in html *** == Example of poetry == === Gil-galad === +-- Gil-galad was an Elven-king. Of him the harpers sadly sing: The last whose realm was fair and free Between the mountains and the sea. +++ His sword was long, his lance was keen. His shining helm afar was seen. The countless stars of heaven's field Were mirrored in his silver shield. +++ But long ago he rode away, And where he dwelleth none can say. For into darkness fell his star; In Mordor, where the shadows are. --+ //JRR Tolkien// *-*- ----------------- If you want to copy and paste texts from internet or an other source, you may find tiresome to include the special line break marks (SYMBbigskip), so you can enable in the header of your document this command: %!preproc(tex): "$" '\n\n' === Aux modernes === //Leconte de Lisle// @@begin((center))** Vous vivez lâchement, sans rêve, sans dessein, Plus vieux, plus décrépits que la terre inféconde, Châtrés dès le berceau par le siècle assassin De toute passion vigoureuse et profonde. *-*- Votre cervelle est vide autant que votre sein, Et vous avez souillé ce misérable monde D’un sang si corrompu, d’un souffle si malsain, Que la mort germe seule en cette boue immonde. *-*- Hommes, tueurs de Dieux, les temps ne sont pas loin Où, sur un grand tas d’or vautrés dans quelque coin, Ayant rongé le sol nourricier jusqu’aux roches *-*- Ne sachant faire rien ni des jours ni des nuits, Noyés dans le néant des suprêmes ennuis, Vous mourrez bêtement en emplissant vos poches. @@end((center))** *** == Prose == === The Great God Pan === //Arthur Machen// *-*- "Herbert! Good God! Is it possible?" *-*- "Yes, my name's Herbert. I think I know your face, too, but I don't remember your name. My memory is very queer." *-*- "Don't you recollect Villiers of Wadham?" *-*- "So it is, so it is. I beg your pardon, Villiers, I didn't think I was begging of an old college friend. Good-night." *-*- "My dear fellow, this haste is unnecessary. My rooms are close by, but we won't go there just yet. Suppose we walk up Shaftesbury Avenue a little way? But how in heaven's name have you come to this pass, Herbert?" *-*- "It's a long story, Villiers, and a strange one too, but you can hear it if you like." *-*- "Come on, then. Take my arm, you don't seem very strong." *-*- The ill-assorted pair moved slowly up Rupert Street; the one in dirty, evil-looking rags, and the other attired in the regulation uniform of a man about town, trim, glossy, and eminently well-to-do. Villiers had emerged from his restaurant after an excellent dinner of many courses, assisted by an ingratiating little flask of Chianti, and, in that frame of mind which was with him almost chronic, had delayed a moment by the door, peering round in the dimly-lighted street in search of those mysterious incidents and persons with which the streets of London teem in every quarter and every hour. Villiers prided himself as a practised explorer of such obscure mazes and byways of London life, and in this unprofitable pursuit he displayed an assiduity which was worthy of more serious employment. Thus he stood by the lamp-post surveying the passers-by with undisguised curiosity, and with that gravity known only to the systematic diner, had just enunciated in his mind the formula: "London has been called the city of encounters; it is more than that, it is the city of Resurrections," when these reflections were suddenly interrupted by a piteous whine at his elbow, and a deplorable appeal for alms. He looked around in some irritation, and with a sudden shock found himself confronted with the embodied proof of his somewhat stilted fancies. There, close beside him, his face altered and disfigured by poverty and disgrace, his body barely covered by greasy ill-fitting rags, stood his old friend Charles Herbert, who had matriculated on the same day as himself, with whom he had been merry and wise for twelve revolving terms. Different occupations and varying interests had interrupted the friendship, and it was six years since Villiers had seen Herbert; and now he looked upon this wreck of a man with grief and dismay, mingled with a certain inquisitiveness as to what dreary chain of circumstances had dragged him down to such a doleful pass. Villiers felt together with compassion all the relish of the amateur in mysteries, and congratulated himself on his leisurely speculations outside the restaurant. *-*- They walked on in silence for some time, and more than one passer-by stared in astonishment at the unaccustomed spectacle of a well-dressed man with an unmistakable beggar hanging on to his arm, and, observing this, Villiers led the way to an obscure street in Soho. Here he repeated his question. *--* === The Raven === //Poe// //1845// *-*- -**-Once upon a midnight dreary, while I pondered, weak and weary, Over many a quaint and curious volume of forgotten lore, While I nodded, nearly napping, suddenly there came a tapping, As of some one gently rapping, rapping at my chamber door. "'Tis some visitor", I muttered, "tapping at my chamber door — Only this, and nothing more." *-*- Ah, distinctly I remember it was in the bleak December, And each separate dying ember wrought its ghost upon the floor. Eagerly I wished the morrow; — vainly I had sought to borrow From my books surcease of sorrow — sorrow for the lost Lenore — For the rare and radiant maiden whom the angels name Lenore — Nameless here for evermore. *-*- And the silken sad uncertain rustling of each purple curtain Thrilled me — filled me with fantastic terrors never felt before; So that now, to still the beating of my heart, I stood repeating, "'Tis some visitor entreating entrance at my chamber door — Some late visitor entreating entrance at my chamber door; — This it is, and nothing more." *-*- Presently my soul grew stronger; hesitating then no longer, "Sir," said I, "or Madam, truly your forgiveness I implore; But the fact is I was napping, and so gently you came rapping, And so faintly you came tapping, tapping at my chamber door, That I scarce was sure I heard you" — here I opened wide the door; — Darkness there, and nothing more. *-*- Deep into that darkness peering, long I stood there wondering, fearing, Doubting, dreaming dreams no mortal ever dared to dream before; But the silence was unbroken, and the stillness gave no token, And the only word there spoken was the whispered word, "Lenore?" This I whispered, and an echo murmured back the word, "Lenore!" — Merely this, and nothing more. *-*- Back into the chamber turning, all my soul within me burning, Soon again I heard a tapping somewhat louder than before. "Surely," said I, "surely that is something at my window lattice: Let me see, then, what thereat is, and this mystery explore — Let my heart be still a moment and this mystery explore; — 'Tis the wind and nothing more." *-*- Open here I flung the shutter, when, with many a flirt and flutter, In there stepped a stately raven of the saintly days of yore; Not the least obeisance made he; not a minute stopped or stayed he; But, with mien of lord or lady, perched above my chamber door — Perched upon a bust of Pallas just above my chamber door — Perched, and sat, and nothing more. *-*- Then this ebony bird beguiling my sad fancy into smiling, By the grave and stern decorum of the countenance it wore. "Though thy crest be shorn and shaven, thou," I said, "art sure no craven, Ghastly grim and ancient raven wandering from the Nightly shore — Tell me what thy lordly name is on the Night's Plutonian shore!" Quoth the Raven, "Nevermore." *-*- Much I marveled this ungainly fowl to hear discourse so plainly, Though its answer little meaning — little relevancy bore; For we cannot help agreeing that no living human being Ever yet was blest with seeing bird above his chamber door — Bird or beast upon the sculptured bust above his chamber door, With such name as "Nevermore." *-*- But the raven, sitting lonely on the placid bust, spoke only That one word, as if his soul in that one word he did outpour. Nothing further then he uttered — not a feather then he fluttered — Till I scarcely more than muttered, "other friends have flown before — On the morrow he will leave me, as my hopes have flown before." Then the bird said, "Nevermore." *-*- Startled at the stillness broken by reply so aptly spoken, "Doubtless," said I, "what it utters is its only stock and store, Caught from some unhappy master whom unmerciful Disaster Followed fast and followed faster till his songs one burden bore — Till the dirges of his Hope that melancholy burden bore Of 'Never — nevermore'." *-*- But the Raven still beguiling all my sad soul into smiling, Straight I wheeled a cushioned seat in front of bird, and bust and door; Then upon the velvet sinking, I betook myself to linking Fancy unto fancy, thinking what this ominous bird of yore — What this grim, ungainly, ghastly, gaunt and ominous bird of yore Meant in croaking "Nevermore." *-*- This I sat engaged in guessing, but no syllable expressing To the fowl whose fiery eyes now burned into my bosom's core; This and more I sat divining, with my head at ease reclining On the cushion's velvet lining that the lamplight gloated o'er, But whose velvet violet lining with the lamplight gloating o'er, She shall press, ah, nevermore! *-*- Then methought the air grew denser, perfumed from an unseen censer Swung by Seraphim whose footfalls tinkled on the tufted floor. "Wretch," I cried, "thy God hath lent thee — by these angels he hath sent thee Respite — respite and nepenthe, from thy memories of Lenore Quaff, oh quaff this kind nepenthe and forget this lost Lenore!" Quoth the Raven, "Nevermore." *-*- "Prophet!" said I, "thing of evil! — prophet still, if bird or devil! — Whether Tempter sent, or whether tempest tossed thee here ashore, Desolate yet all undaunted, on this desert land enchanted — On this home by horror haunted — tell me truly, I implore — Is there — is there balm in Gilead? — tell me — tell me, I implore!" Quoth the Raven, "Nevermore." *-*- "Prophet!" said I, "thing of evil — prophet still, if bird or devil! By that Heaven that bends above us — by that God we both adore — Tell this soul with sorrow laden if, within the distant Aidenn, It shall clasp a sainted maiden whom the angels name Lenore — Clasp a rare and radiant maiden whom the angels name Lenore." Quoth the Raven, "Nevermore." *-*- "Be that word our sign in parting, bird or fiend," I shrieked, upstarting — "Get thee back into the tempest and the Night's Plutonian shore! Leave no black plume as a token of that lie thy soul hath spoken! Leave my loneliness unbroken! — quit the bust above my door! Take thy beak from out my heart, and take thy form from off my door!" Quoth the Raven, "Nevermore." *-*- And the Raven, never flitting, still is sitting, still is sitting On the pallid bust of Pallas just above my chamber door; And his eyes have all the seeming of a demon's that is dreaming, And the lamplight o'er him streaming throws his shadow on the floor; And my soul from out that shadow that lies floating on the floor Shall be lifted — nevermore! *--* == Example unix code == If you need to include some letters already found in the txt2tags code (such as the pipe ""|""), you can prevent their execution by surrounding them with double quote ("""""") | find . -print ""|"" cpio -o -H newc ""|"" gzip -9 > ../initrd.gz |