Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: What software should I use to write a textbook?
84 points by laurieg on Aug 18, 2018 | hide | past | favorite | 68 comments
I will be delivering it as a PDF and thinking about printing a version in the future. What are the best software solutions for this?



If you have time to invest, go for a TeX variant (LaTeX or ConTeXt). That gives full control over any typesetting detail.

I’d recommend ConTeXt [0] over LaTeX. A minimal document is as simple as

    \starttext
    Start writing here…
    \stoptext
and you can go a long way from there, including making ebooks. Much better than LaTeX for layout control, language support, graphics integration, table generation, etc… It’s also intimately integrated with Lua for your scripting needs.

The documentation is possibly its weak point: it’s rich and comprehensive, although somewhat sparse and at times heavily technical. But it’s worth the effort, IMHO.

You may get inspired by the TeX showcase [1] (not only ConTeXt, but also LaTeX and plain TeX).

[0] http://wiki.contextgarden.net/Main_Page [1] https://www.tug.org/texshowcase/


There's also the Tufte style layout, latex template here: https://www.latextemplates.com/template/tufte-style-book

I think works really well for textbooks, with well-placed footnotes, sufficient margin space to make notes, etc.

There are, of course, many other styles, if you do not wish to utilize page area more efficiently.

---

If you need nice equations (or even just Greek alphabet), and a no-hassle reference linking system, I can't think of anything other than TeX derivatives that will do a good job.

PS: If OP wants more useful suggestions, we need to know the topic and/or what kind of content the book will contain -- text, equations, floats/figures, photographs, etc.


For a book I'd recomment ConTeXt. It's rougher around the edges but it's geared more towards "rich" presentation with sidebars, imaages, maybe even some color vs LaTeX which at it's core is optimized for things like journal articles with relatively little formatting.

If I was going to compare them to commerical software, ConTexT is closer to InDesign and LaTeX is closer to Word.


I'll simply quote a thread by William Adams on the context mailing list (copied from here http://wiki.contextgarden.net/Comparison_between_ConTeXt_and..., the link to the mailing list does not work)

With a graphical tool, one is limited to the automation which the developers are willing to build into the tool and sentenced to handling manually everything else, every time that there's a change, e.g., if you have a keyword block on your opening article pages aligned against the outside gutter and the layout program can't place it automatically and contextually, then every time the article changes from opening to a left to a right or vice-versa one has to make that change manually.

I wrote up a longer comparison once upon a time --- Scribus isn't that much different from InDesign and Quark, so the criticism holds:

While I'm no TeX wizard, I prefer it because it allows one to off-load some of the tedium and repetitiveness to the computer, as opposed to repeatedly solving variations of the same problems by hand time after time after time.

So,

* using Quark is like being chained to a an oar which is covered w/ splinters and mostly broken at the other end and which will randomly break due to being poorly carved (Quark has crashed on me 183 times this year) leaving one adrift or run aground, or sometimes returning the vessel to its starting point (a few of those crashes have resulted in unrecoverable document corruption --- my autobackup folder may contain 2 or 3 GBs of files for a given iteration of a particular project each month) --- the oar can be smoothed somewhat and reinforced (by purchasing or finding XTensions, using XTags &c.) and periodically one is required to purchase a new oar (sometimes just after the previous one has been customized adequately). For some tasks, one can impress any graphic designer as a galley slave to ease the effort for others, but while charts are available, there are no automagic navigation options and every journey must be manually piloted.

* using InDesign is pretty much the same except the oar is smoother and stronger (it's crashed 29 times on me thus far this year), there aren't as many customization options and it's not quite as easy to find a candidate for impressment (though soon it'll be as easy as for Quark). Charts are available, but again, piloting is strictly manual.

* using Plain TeX one has to craft the vessel's oar oneself (as well as the rest of the vessel unless one is typesetting a clone of The TeXbook), but it's as sturdy and as nice a one as one's skills allow and can even be an engine which moves the vessel in and of itself --- it can be difficult or impossible to find people suitable to help w/ either carving the oar or using it though, but once a given journey is worked out, the oar becomes magical and rows for itself except for when one runs into an unplanned for obstacle (the navigation charts are old ones and not often up-dated, with a lot of “terra incognita”), allowing one an auto-pilot option for certain journeys, dependent upon one's skill. using ePlain, an oar is provided, can be customized, and can be enchanted and the charts are okay, but have a lot of “terra incognita” on them.

* using LaTeX, an oar is provided and there're lots of nifty customizations and improvements already available, and one can impress additional oars from CTAN, however on a semi-random basis, adding one oar will break other oars, sometimes leaving one adrift or run aground. One can enchant a set of oars to accomplish a given journey, easing the piloting requirement, and the navigation charts are decent and obstacles are fairly well-known.

* using ConTeXt, a very nice oar is provided, which has lots of customization options, but the navigational charts aren't easily read by a traditionally trained navigator at first, although they are fairly compleat and most journey can be carefully worked out, but once one is, it is quite automatic and there's a good auto-pilot option.


I am comfortable with making anything in Adobe Indesign.

If you are going to make things in Indesign, it should be as a last step process, after the full draft has been made. Otherwise you will slow down your writing by a lot.

Quark is rather outdated IMO, little has changed over the years. It has terrible UI and native keybind controls

I would use some flavor of markdown + some notetaking tool that supports it. A good example would be gitbooks.io, there's other ones out there too.

Latex & Variants is what has always been used for textbooks. Can't go wrong with it


Don't write your text in some TeX dialect. It's not worth it.

You can write your text in Markdown and convert it to TeX, DocBook or directly to PDF using Pandoc (https://pandoc.org). In my opinion Markdown is much easier to type and Pandoc gives you everything you'll need for styling your document.


I use both pandoc and LaTeX in my day job. I have to disagree somewhat with your first statement. I think it varies by the use cases.

I usually start a writing project in pandoc Markdown, until at some point I have many equations, figures, or tables that I have to switch to LaTeX to continue. I know pandoc can support all of these elements but it does not give you as much freedom as LaTeX. Equation and theorem numbering, figure and subfigure referencing, fine tuning the layout of a table ... things like these that are natural in LaTeX require extra effort to be done well in Markdown. And of course, there are things that LaTeX does not do well naturally, for example, code highlighting. Should always pick the right tool for the right task.


Okay, these are valid points. I personally tend to choose against switching to LaTeX. But I assume we agree that you shouldn't start with LaTeX right away if not absolutely necessary.


Give LyX (https://www.lyx.org/) a try. It has a TeX/LaTeX backend and a handy UI.

Check a tutorial for the basic workflow and you are all set.

Many people have used it and still use it for their books, theses and such. I wrote my thesis with it back in the days. The best part was to be able to just focus on the writing, not formatting.

There is a layout mimicing the layout used by Edward Tufte in his books. That layout is awesomely readable (a highly subjective observation, I know).


>The best part was to be able to just focus on the writing, not formatting.

I see this 'slogan' frequently when it comes to Tex-based editors. (I realize you are talking about a GUI interface that only uses Tex as its backend... comment isnt really directed to you.)

Is the slogan really true? Perhaps I'm just easily distracted, but I find the exact opposite is true. I spend 1% of the time drafting, and 99% of the time fiddling with Tex, loading packages to make a cool kind of ligature, then ending up reading about the history of ligatures, then writing my own package to create a ligature more consistent with those used in 17th century upper Bavaria, then adding more features to the package to account for monospaced fonts, etc... and finally, at around 4:00 am, I realize I've only written a single sentence.

Maybe it's just me... but the slogan seems like something an alcoholic in denial would say.


In my experience it is true; of course some areas may require more detail and attention and tweaking and summoning the Evil Red Text in LyX.

In your case, it seems you are not really writing the text... You are making cosmetic adjustments. And it is fine but it should not be done up front, IMO. As for ligatures, TeX should handle ligatures automagically, but I took that as a general point and yeah, I agree -- one can always find things to tweak.

Process-wise, it is better to "just write". Most of the cosmetics is taken care of by LyX with minimal effort. Add a comment for something to check later. Make the process iterative, if you try to write each line as production quality from scratch, I doubt you will ever finish.


I was being a bit facetious. I just know I'm not the only person out there who WASTES an enormous amount of time fiddling with LaTeX instead of working.

For pure composition, you are certainly correct... do not write in the Tex editor... Just compose with WORD or something, and then take care of the formatting in Tex at the end.

(Regrettably, though, I am involved in several projects where the composition necessarily has to be in the LaTeX editor as the format and cosmetic adjustments are very important.)

It seems a lot of the helpful questions and answers on the various LaTeX websites come from some PhD student working on his dissertation. I kind of smile with sympathy at their earnest questions about how to print an equation upside-down and backwards in a table cell while using multicolumn (just a silly example...) I know whoever was writing the question was, like me, surfing the internet and focusing on formatting instead of getting back to work and finishing the damn dissertation.


If OP wishes to use Latex, they should probably use luatex or xetex - which are pretty much drop in replacements, but have unicode support. I believe the future of latex is going to be luatex.


My process is to use markdown [1] (very little style related formatting) and then convert to a desired format using pandoc [2]. Building multiple books that look the same, later revisions, etc - becomes really easy.

One of the benefits is that you can convert a chapter to a webpage and gauge interest in the book itself.

[1] https://daringfireball.net/projects/markdown/

[2] http://pandoc.org/


+1 for this. I do this at work for documentation. Markdown presents well on github and using Pandoc with Makefiles so I don’t have to remember the options for generating PDFs, Word format, etc.


Begin with plain ASCII text. It's very easy to get distracted by the formatting and looks. Content is what's important. So begin with a basic editor like notepad/vi/emacs. Perhaps at best markdown. Get it done, then edited, then you can typeset with something like Latex/Word.


So many times this. I'm presently developing a lot of documents for my office with a group of people. If we'd just focused on the content, and not the formatting (layout, font, etc.) we'd have been done weeks ago. Instead, just this morning while peer reviewing a document for the final version, we got bogged down in how to format a section and lost 30 minutes to a pointless discussion that should've been saved for the final revision (once the content was reviewed).

Simple markdown or similar to have a rough structuring/formatting that there are many good editors and presenters for today. Then do a pass through with LaTeX or Word or whatever to (LaTeX may be more appropriate for certain technical documents) after you've written up the content.


I don't see why Latex shouldn't be used for that. Whether you write # (markdown) or \section (Latex) to start a new section doesn't really matter for you as a writer, but the latter already gives you a correctly formatted basic version "for free" (who would be insane enough to use Word for an entire textbook?).

If you get distracted by the formatting and looks during the writing process, then just limit yourself to the basic Latex commands (\section, \emph, etc.).


Just that. Maybe Word in the first place, for the spell checking. But, other than that, just use it as a plain text editor.

I also find it useful to create a new file for each chapter.


You don't need Word for spell checking. For instance, Emacs can use ISpell, ASpell, etc.


Good to know. I'll check if Sublime Text supports spell checking as well :)


And in emacs you can use org mode with export to pdf though latex


Latex is a bad recommendation I'd say. Just use AsciiDoc. The rest I agree with.


Writing in LaTeX is a bad recommendation indeed. It's huge (my install is over 5gb) it's slow (my thesis took minutes to render), hard to work with, has terrible error messages, and it is beyond difficult placing figures where you want them.

It is the easiest syntax for equations, but not everyone needs those. It does look better than Word, but it is a very high cost for a bit of good-looking.


Check out Pollen: http://docs.racket-lang.org/pollen/

The author of the package, Matthew Butterick, wrote several books with it, such as

- Practical Typography: https://practicaltypography.com/

- Beautiful Racket: https://beautifulracket.com/

Looking at the results, I can't help but be impressed. If I was writing a book, I would start here.

I think you can get it to output LaTeX which you can then use to generate your final PDF and ePub, if you like.

Previous HN discussion here with some other real-world users chiming in with their experiences: https://news.ycombinator.com/item?id=15335010


"What is Best" always depends on what you need. For writing a book, the final answer is probably LaTeX. That's assuming what you need is not highly simple. (However, the advice to work in plain text before you typeset is really solid)

However... for something simple, I'll point to https://casual-effects.com/markdeep/ I've found that Visual Studio Code + https://marketplace.visualstudio.com/items?itemName=Flixs.vs... make for a lovely editing experience. Basically, you write plain text, hit ctrl-s and see formatted HTML in a side panel. The homepage explains how to generate PDFs.

Here's some notes about fancy typesetting from someone who wrote a book using Markdeep: https://imaginary-institute.com/resources/MarkdeepToInDesign...


As a sidenote that "someone" is Andrew Glassner [0] :) - i.e. the editor of the venerable Graphics Gems series and much else. The books you refer to are here

https://www.glassner.com/portfolio/deep-learning-from-basics...

As another examples Google's Filament PBR renderer has beautiful documentation written in Markdeep as well: https://google.github.io/filament/Filament.md.html

[0]: https://en.m.wikipedia.org/wiki/Andrew_Glassner


Too many commenters are thinking about the last steps (layout and pre-print) when the hard parts are everything up to that point. Go purchase a copy of Scrivener and if on Linux then maybe learn org mode really well or else run Scrivener in a VM.


The LaTeX document format is pretty well fit for the use case (it's kinda been made in that sense).

If it's "too complex", you may be interested in reStructuredText, a stricter and more complete alternative to Markdown, that auto-converts well into LaTeX.


It doesn't matter. Stop wasting time on thinking about the right tool and start writing. Way more projects fail because they are never finished (or even properly started) than because of wrong software.


Really. Writing text beats fighting with (whatever) tech.

Once the writing is done, you have something you know makes the formatting fight worth waging. That way, the half-hour you'll spend finding a bloody compromise for some problem won't be cutting into your writing.


Your favorite coding editor (intellij, vim, emacs, notepad++,...), markdown and pandoc.

Markdown lets you focus on content and structure, pandoc creates a PDF of it by using latex, which you can later use to define how the text shall be printed (twosided? Us legal/a4/a5? Title, author,... ) and gives you latex formatted text, which is always correct & professional.

Pandoc also allows tables and images in markdown.


Please do not use LaTeX. If your textbook is supposed to have special layout needs, you will have a hard time with LaTeX. Tables are a real nuisance in LaTeX as well - normally you have your data in some other tool like Excel or some Jupyter notebook or CSV. Turning the data into a nicely looking and well-placed LaTeX table is not straightforward. Sure, there are specialized LaTeX extension packages for a lot of functionalities, but you will need time to get familiar with them. I would just start with MS Office or LibreOffice - both offer sufficient functionality and if you need more specialized tools, then those tools usually have an import function for DOCX /ODT files.


Personally I find it pretty painful creating large documents in Word. Creating documents in Latex helps me focus on the text/structure without worrying about figure/table placement (I can still have them in the markup, but and fix all the formatting issues after I’ve written the text).

I think it depends on author mentality somewhat. Word works well for some, Latex for others.

It might also be worth considering Markdown or plain HTML. Particularly if an ePub/kindle version is a possibility.


Use a word processor to write a book. Think about that other stuff after your book is written. You don't need to think about it yet. You need to write that book.


Yeah, I think one of the risks here is spending so much time picking the right tool that you lose interest in writing the book. Latex is great for writing papers, formatting, references, but arguably not great for churning out thoughts. Sometimes a pencil and paper will do.


I would start by writing it in whatever software you find most conducive to long writing and editing sessions (be that MS Word, Dark Room, Scrivener, or a programmer’s text editor).

Then convert it to the format you want to use for formatting and layout.


I spent a lot of time on this before I settled on Pandoc and reStructuredText. However, if you have a publisher, they may dictate the medium.

I wrote about my experience writing a book on Emacs in Emacs here, and the tooling I used [1]

[1] https://www.masteringemacs.org/article/how-to-write-a-book-i...


Have you had a look at Apple iBooks author? https://www.apple.com/ibooks-author/


Pages now saves ePub, might be a better tool for most of the job.


Use whatever tool allows you to sit down and write content sooner. If you don't know Latex, don't waste time learning it (unless the book has a lot of formulas in it). So if you already know how to use Word, (or similar word processors like the Libreoffice one) use that. They are perfectly fine for large text base stuff. If you have plenty of images it will get heavy, but I think there might be a way to link to external files?). Rendering in PDF from MS Word works very well. If you need to share it with somebody for review and comments, most people would be able to open it and read it and comment directly on it. And the WYSIWIG aspect of it should not be underestimated. The amount of personalization of fonts, spaces, etc, is way larger than other options.


I highly recommend https://github.com/softcover/softcover see dogfooded demo http://manual.softcover.io/book

You can write the text either as Markdown or LaTeX, and softcover will build PDF, HTML, ePUB, mobi versions of the book for you.

It's the only ePub generation strategy that I know of that doesn't butcher the math.


I agree with what others have said, that there is no best system/framework because it depends on the use-case. But I haven't seen Sphinx (which I'm currently attempting to use) here, so I'll mention it. It's often used for web-based docs but has built-in PDF output via pandoc. The Hitchhiker's Guide to Python is one example of a book produced with it:

https://docs.python-guide.org/


Looks like you should use pandoc (or asciidoc) from within your favorite text editor (e.g Visual Studio Code, Atom, ...) Using raw LaTeX is wasted effort IMHO, only commit to it, if you really need it. If you want to sell later as E-Book, i recommended to get the technical details right now. This might give you an edge over authors who are only able to deliver a converted pdf.



RMarkdown can make for some great textbooks. Take a look at the online version of R for Data Science, to see what can be accomplished:

http://r4ds.had.co.nz

https://github.com/hadley/r4ds


Asciidoctor is worth a look, in line with plain text / markdown but offers a bit more in terms of textbook specifics.

https://asciidoctor.org/


Use your preferred variation of plaintext - markdown, reStructuredText, etc. - in as plain an editor as you can come up with. (There are plenty of minimalist/distraction free plaintext editors out there if you'd rather not use your favorite code editor.)

The hardest part in long form copy is getting the content written. Anything visual on top is just distraction that will get in your way and slow you down.

Once you've the copy, use Pandoc or equivalent, and then typeset and format using a more sophisticated medium as needed.


To some degree what you use is dependent upon what type of content it is. Is it purely text? Text and some images/graphics? Tables? Equations?

A good starting point for primarily text or text+pics is whatever editor you like to use everyday. Once your content is final (or nearly so) you can export as ascii and then add latex (or variant) formatting.

If it is heavily equation oriented, there are a number of wysiwyg type latex editors that may be helpful or just bite the bullet and start as a latex text document.


None of the suggestions address the writing process and what might facilitate that process. I was so frustrated with existing word processors in that regard that I wrote my own. It's built on my personal work flow augmented with spell checking and find/replace. I did add layout features as an afterthought but rarely use them. I'd market it, but marketing "side projects" is an insurmountable hassle.


Am I allowed to advertise my own work? :) I added some features to Helpinator that make it more convenient to write textbooks, especially on programming. For example, you can add self-check quizzes, step-by-step guides, easily manage code snippets, etc. And you can export to 10+ formats, including PDF. Or export to Github-flavored markdown to submit it to Github.


I've written, typeset and published a book about a game (a variant of contract bridge) [1] using this toolchain: emacs org mode > Pandoc > Adobe Indesign (via ICML). Worked beautifully.

[1] https://www.santeonisto.com/swingbridge


I used Latex for several books and liked it. I once wrote a single book, but in Java and Common Lisp editions, and Latex worked really well for that.

Then I switched to Leanpub.com and never looked back. With Leanpub markdown you can still use Latex for formulas.

I love to write and Leanpub takes almost all of the hassle/overhead out of the process.


I suggest Doconce (https://github.com/hplgit/doconce) which is a language that compiles to latex, html and other formats. It is easy to make a version specialized for tablet etc. It is used quite heavily at my university.


If you want ridiculously high power for doing anything you want with a book in any language, TeX and friends will grant you god's level.

https://en.wikipedia.org/wiki/TeX


You should give Leanpub [0] a shot which is a platform for self-publishers. You not only get full-control over the process, but you can also use various input sources and formats (GitHub/Bitbucket, Dropbox, PDF, ...) and output formats (PDF, EPUB, MOBI).

I write all my books with Markdown and Git/GitHub [1] and release them eventually on Leanpub [2]. Even if you don't want to release the book on their platform, you can take away the output files and publish them somewhere else (e.g. own platform, Amazon).

- [0] https://leanpub.com

- [1] https://github.com/the-road-to-learn-react/the-road-to-learn...

- [2] https://leanpub.com/the-road-to-learn-react


Depends on the topic. If there's a lot of math, you might as well go straight to LaTeX.


I used Scribus to develop a language teaching course book for kids. It's kind of like Adobe's InDesign, but open source. A bit of a learning curve, but once you get the hang of it I find its quite easy to use.


Many tools have been described in this thread.

I'd say, go with the simples you can find (maybe even LibreOffice Writer).

Worry about layout and imagination later.

Make sure the tool you use doesn't get in the way of actually writing the book.


Bookdown is super easy. Some oreilly books (eg R for Data Science) used it.


"The best" is something that does not exist, you have to know what your requirements are. Having said that, I would suggest ASCIIDOC, reStructuredText, or the good old LibreOffice.


Ms word.


I wrote a perl book using pod (the perl doc format). The process was baroque: pod to latex,latex to rtf. Which then gave me an msword interchange format - important for the publisher.

I also wrote a PhD thesis. I started with various msword compatible formats (for process reasons). I curated the documents into markdown and was hoping to use markdown/citeproc to produce a thesis via either msword or latex. However that was going to be a pain in the bum, so I finished it up with latex/hyperref/bibtex.

So, tl;dr I think if your book is not citation or maths heavy and you are in control of the process I would recommend markdown to latex via pandoc. If it’s citation heavy,then I’d probably recommend cutting out the pandoc middleman and going straight to latex/bibtex. If it’s maths heavy then markdown to latex might work. If it’s someone else’s process, I recommend jury rigging something that will get them an MVP.


Emacs, org-mode.


plaintext / .txt / .md


vim!


Vim


Sadly, it's latex.

Yikes




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: