TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Tools I Use to Write Books

472 点作者 misternugget将近 7 年前

33 条评论

akavel将近 7 年前
The most important quote here for me:<p><i>&quot;What kept me from [writing my own tool] was a calm voice in my head telling me that I’m here to write a book, not a preprocessor. [...] Now I have written two books and zero tools, which I consider a success.&quot;</i>
评论 #17917316 未加载
评论 #17917262 未加载
评论 #17918522 未加载
评论 #17917258 未加载
grecy将近 7 年前
I settled on something similar for my needs, and I&#x27;m really happy with it.<p>1. Book is entirely written in LaTeX, every chapter in it&#x27;s own file, master doc with everything combined. I really like having different gutters for left and right pages, ultimate control over formatting, fancy things like Lettrine, header layout and design etc. When I want to do something across the entire doc I write a new command and can use it anywhere.<p>I Create perfectly formatted print-ready pdf to go to printers directly from this.<p>2. Run LaTeX file through pandoc to create an ePub.<p>A little known trick that is now supported by pandoc is conditionals in the LaTeX doc, so when formatting gets hairy I declare commands like this in the master LaTeX document:<p><pre><code> \iftoggle{ebook}{ \newcommand{\textbreak}{\newline\hrule\newline} }{ \newcommand{\textbreak}{\begin{center}\LARGE{$\Psi\quad\Psi\quad\Psi$}\end{center}} } </code></pre> So I can use \textbreak{} anywhere I want, and I know it will be formatted perfectly in both output formats.<p>3. Un-pack the ePub and tune some of the html&#x2F;css to my personal taste, then pack it back together. I run it through kindlegen to make sure it&#x27;s valid, and I have an epub&#x2F;mobi ready to upload to stores.<p>I like this workflow so much I&#x27;m using it again for my next book
评论 #17917882 未加载
davedx将近 7 年前
I&#x27;m writing a sci-fi book at the moment. Somehow I&#x27;ve come much further than any of my other book writing attempts, including one that I actually (self)-published.<p>I use Sublime Text, sometimes in distraction free mode, but usually not because I often want to Google sciencey things.<p>I have a single file called &quot;story.txt&quot; that has all the important notes - the names, ages and visual descriptions of the main characters, a detailed (historical) timeline, and chapter outlines I wrote before I started when I knew roughly what the overall plot was going to be. The chapter numbering has changed drastically but the overall outline has stayed pretty true to the original idea.<p>I really like this system. Keep it simple and focus on writing!
miles_matthias将近 7 年前
I&#x27;ve written a couple of technical books, and then I&#x27;ve helped my wife grow her business as a USA Today best selling romance author.<p>The biggest challenge here, to me, isn&#x27;t writing the book or figuring out what tools to use, but it&#x27;s marketing. Email lists, FB ads, etc. are really what drive the success or failure of your book. Nathan Barry&#x27;s writing on this in Authority is my bible for that.<p>Also, if we&#x27;re talking tools, shout out to Leanpub. Love that platform, especially for developer books!<p>EDIT: Nathan Barry doesn&#x27;t specifically talk about FB Ads, so in terms of a marketing bible, I guess courses and private FB groups have helped us the most. This guy is actually the main goto for fiction authors: <a href="https:&#x2F;&#x2F;selfpublishingformula.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;selfpublishingformula.com&#x2F;</a>
评论 #17920700 未加载
评论 #17919012 未加载
评论 #17918814 未加载
nickjj将近 7 年前
If anyone is curious this open source tool will convert markdown (with support for images) into pdf, epub, mobi and html:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;softcover&#x2F;softcover" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;softcover&#x2F;softcover</a><p>It was written by the same guy who created the original Rails tutorial. You&#x27;ll be able to generate books that look and feel like this <a href="https:&#x2F;&#x2F;www.railstutorial.org&#x2F;book" rel="nofollow">https:&#x2F;&#x2F;www.railstutorial.org&#x2F;book</a>.<p>I&#x27;ve released a couple of PDFs using it, and it&#x27;s pretty decent to work with. There&#x27;s room for improvement but I haven&#x27;t come across anything better.
评论 #17920361 未加载
Jeremysr将近 7 年前
For project-based tutorials&#x2F;books, which are centred around building a program step-by-step by following a series of human-readable diffs, I think a tool is very much needed.<p>For <a href="https:&#x2F;&#x2F;viewsourcecode.org&#x2F;snaptoken&#x2F;kilo&#x2F;02.enteringRawMode.html" rel="nofollow">https:&#x2F;&#x2F;viewsourcecode.org&#x2F;snaptoken&#x2F;kilo&#x2F;02.enteringRawMode...</a> , the code is kept in a git repo where each commit is a step in the tutorial. This way steps can be modified, reordered, or split into more steps using git interactive rebase (git rebase -i).<p>I&#x27;m working on a tool which abstracts away git rebase, and gives you a nicer interface for manipulating the series of steps in your tutorial. For example, you can run `leg 3` to checkout step 3, make edits to it, and then run `leg amend` to apply the changes, resolving conflicts as the changes make their way through the rest of the tutorial&#x27;s steps.<p>The tool is still in very early development, but here&#x27;s a quick tutorial to get a better idea of how it works: <a href="https:&#x2F;&#x2F;github.com&#x2F;snaptoken&#x2F;leg&#x2F;blob&#x2F;master&#x2F;TUTORIAL.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;snaptoken&#x2F;leg&#x2F;blob&#x2F;master&#x2F;TUTORIAL.md</a><p>Also, I&#x27;m playing around with a &quot;literate diff&quot; file format that might be of interest: <a href="https:&#x2F;&#x2F;github.com&#x2F;snaptoken&#x2F;tgc-tutorial&#x2F;blob&#x2F;master&#x2F;doc&#x2F;02.oneFellSweep.litdiff" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;snaptoken&#x2F;tgc-tutorial&#x2F;blob&#x2F;master&#x2F;doc&#x2F;02...</a>
评论 #17920633 未加载
leephillips将近 7 年前
From the article:<p>&quot;But, most importantly, the code is also duplicated: one version lives in a Markdown file and one (or more) lives in the code folder that comes with the book. If I want to update a snippet of code presented in the book, I have to manually update every copy of it. Yes, cumbersome.&quot;<p>I had a similar problem in writing a book about gnuplot: keeping code samples, code in the text, and the generated plots synchronized. I decided doing it manually was too tedious and error-prone, so I wrote some Pandoc filters to do it for me: <a href="https:&#x2F;&#x2F;lee-phillips.org&#x2F;panflute-gnuplot&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lee-phillips.org&#x2F;panflute-gnuplot&#x2F;</a>
评论 #17924175 未加载
funkaster将近 7 年前
I&#x27;m pretty sure that orgmode + Babel would get him a lot closer to what he wants: you could have chunks of code that edit using the natural editor mode and can join them together in an external file (tangle) in any way you want. You can even post-process right from the editor when tangling.<p>Orgmode Babel: <a href="https:&#x2F;&#x2F;orgmode.org&#x2F;worg&#x2F;org-contrib&#x2F;babel&#x2F;" rel="nofollow">https:&#x2F;&#x2F;orgmode.org&#x2F;worg&#x2F;org-contrib&#x2F;babel&#x2F;</a>
评论 #17921843 未加载
bovermyer将近 7 年前
I use pandoc-flavored Markdown (it&#x27;s a specific superset), sprinkled occasionally with LaTeX to do things like force page breaks in specific places.<p>I should write a blog post like this. My use case is different, since I write role-playing game books.
logfromblammo将近 7 年前
I use a plaintext editor to write xhtml+css, and 7Zip to go directly to epub.<p>I made a blank epub template with 50 empty chapters in it, so when starting a new book, I copy that and write new IDs and strings to the metadata, and if I finish it, I delete the unused chapters and remove their entries from the metadata files. It&#x27;s easier to delete empties than add new chapters, and doing the metadata by hand ensures there&#x27;s no auto-generated cruft in my file.<p>For illustrations I use Paint or GIMP or Inkscape, but the template doesn&#x27;t have more than just a cover image in it.<p>After testing various ebook readers, there&#x27;s no way I would recommend xhtml+css zipped to epub for anything technical. The only reader that actually renders text they way I expect, right out of the box, is Edge. Epub is for novels, not textbooks, papers, or manuals.
ryneandal将近 7 年前
I use Scrivener on Mac for putting together various thoughts for game design docs. Adding references for the various things I&#x27;ve come across to assist with any hobby game dev is awesome, particularly when attempting historical accuracy.
dorfsmay将近 7 年前
I&#x27;m surprised not to see any mention of AsciiDoc, I know that it is what some publishers use.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;AsciiDoc" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;AsciiDoc</a>
评论 #17924167 未加载
_Nocturnal将近 7 年前
I wrote a free e-book tutorial for the Kitura web framework called Kitura Until Dawn [0] using an almost identical workflow: per-chapter Markdown files, pandoc, and kindlegen. Pandoc is an amazing tool. In addition to tweaking some Latex stuff to get the output I wanted, I also use a simple Lua script to rewrite internal links so that they don&#x27;t break. I export to several different downloadable formats, and host an HTML version via GitBook[1] - though I may self-host at some point.<p>I have the entire book in a GitHub repository [2], including the export script [3], which may be of interest to those wishing to write a book a similar way.<p>(Pardon the new account, but my &quot;normal&quot; HN account is more closely tied to my IRL identity than my Nocturnal identity.)<p>[0]: <a href="https:&#x2F;&#x2F;learnkitura.com" rel="nofollow">https:&#x2F;&#x2F;learnkitura.com</a><p>[1]: <a href="https:&#x2F;&#x2F;nocturnal.gitbook.io&#x2F;kitura-until-dawn&#x2F;" rel="nofollow">https:&#x2F;&#x2F;nocturnal.gitbook.io&#x2F;kitura-until-dawn&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;NocturnalSolutions&#x2F;KituraBook" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;NocturnalSolutions&#x2F;KituraBook</a><p>[3]: <a href="https:&#x2F;&#x2F;github.com&#x2F;NocturnalSolutions&#x2F;KituraBook&#x2F;blob&#x2F;master&#x2F;export.sh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;NocturnalSolutions&#x2F;KituraBook&#x2F;blob&#x2F;master...</a>
xrd将近 7 年前
I wrote a book for O&#x27;Reilly and they have something called O&#x27;Reilly Snippets which allows you to embed snippets from another file inside your asciidoc files. It sort-of solves the problem noted in the OP.<p>The problem I found with it was that I would add the snippet, then later in the chapter, I would refactor the code to better fit the story, and that worked, as long as you only needed one copy of the file. But, it didn&#x27;t work if you introduced a basic version of the code and then later elaborated and expanded that code and wanted it to reside in the same file. Additionally, you have to keep the code in the same repository, which I didn&#x27;t want to do since I published companion repositories (which couldn&#x27;t contain the sources for the book, obviously) and I didn&#x27;t want to maintain and synchronize two copies of a file.<p>So I wrote a little preprocessor that ingested a subtle variation on the snippets O&#x27;Reilly pioneered. Normal snippets work. But also, you could specify a file and a SHA hash, and if it saw that, it would pull the file at the commit (just using git show). Then I could update the file inside the repository as the code progressed, and still have all the sample code. And my repository always had working code, no matter what branch or point in time I had checked out.<p>It&#x27;s here: <a href="https:&#x2F;&#x2F;github.com&#x2F;xrd&#x2F;oreilly-snippets&#x2F;blob&#x2F;master&#x2F;README.md#special-additions-to-snippets" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;xrd&#x2F;oreilly-snippets&#x2F;blob&#x2F;master&#x2F;README.m...</a>
runemadsen将近 7 年前
There&#x27;s also this! <a href="https:&#x2F;&#x2F;github.com&#x2F;magicbookproject&#x2F;magicbook" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;magicbookproject&#x2F;magicbook</a>
Koshkin将近 7 年前
I find TeXmacs to be one of the few most amazing and useful pieces of software in existence.
delinka将近 7 年前
I&#x27;ve recently been researching this for my own needs, and this author&#x27;s md -&gt; pandoc -&gt; etc chain is pretty much where I settled. Reading this article, I was hoping to find a way to point code blocks at a git repo (local, remote, w&#x2F;e) so that as code changes, the book follows (I do mean during the formatting phase - not that an ebook would follow a remote repo to get code.) I did not find that solution in this article.<p>Has anyone come up with a method for doing what I want? Maybe the ```lang code blocks in md could take parameters like repo, file, line range; then an update to pandoc would fix it all right up. Thoughts?
评论 #17918201 未加载
评论 #17917480 未加载
aikah将近 7 年前
Interesting, I tried to use <a href="https:&#x2F;&#x2F;github.com&#x2F;jostylr&#x2F;litpro-commonmark" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jostylr&#x2F;litpro-commonmark</a> to do literate programming when writing a tutorial but was completely unable to go from their specific markdown flavor to a simple markdown file void of all extra macros and annotations that I could just transform to HTML. i didn&#x27;t know about &quot;pp&quot; which looks like what I need to use.
codazoda将近 7 年前
I used Libre Office to write a few short eBooks. I found the &quot;flow&quot; of writing in a word processor better for me and it avoided the thought of writing my own tools for the job. I&#x27;ve published step-by-step instructions for the document setup that worked best for me.<p><a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;dp&#x2F;B00A4112ZM" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;dp&#x2F;B00A4112ZM</a>
amrrs将近 7 年前
Recently came across this article where it shows how easy it&#x27;s to write a book using `bookdown` (an R package that uses R + markdown) and publishing on Amazong <a href="https:&#x2F;&#x2F;blog.datascienceheroes.com&#x2F;how-to-self-publish-a-book&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.datascienceheroes.com&#x2F;how-to-self-publish-a-boo...</a>
munificent将近 7 年前
The fact that Thorsten manually synchronizes the snippets in the text and external source files seems like crazy talk to me. But the fact that he&#x27;s cranked out two really good books on languages while I&#x27;m still slowly lumbering through my one [1] is proof that his system works for him.<p>Personally, I&#x27;m too error-prone to pull that off. I change the code snippets frequently after chapters are done (often in response to bug reports from readers) and having to manually update the snippets in the text would drive me bonkers.<p>Also, I want to rigorously, automatically validate that the code in the book is correct and contains everything you need.<p>To do that, I wrote a Python script [2] that weaves the code and the Markdown together. In the Markdown files, you use a marker like (here in the chapter &quot;Strings&quot;):<p><pre><code> ^code memory-include-object (2 before, 2 after) </code></pre> This means &quot;insert the code snippet labeled &quot;memory-include-object&quot; here. Include 2 lines of contextual code (which is shown grayed out) before, and 2 after. In the code, the marker looks like:<p><pre><code> &#x2F;&#x2F;&gt; Strings memory-include-object #include &quot;object.h&quot; &#x2F;&#x2F;&lt; Strings memory-include-object </code></pre> The &quot;&#x2F;&#x2F;&gt;&quot; begins the snippet and the &quot;&#x2F;&#x2F;&lt;&quot; ends it.<p>The build script reads the &quot;^code&quot; markers and finds the snippet of code in the sources that correspond to it, as well as any desired surrounding lines. But it can also do a lot of other useful things with the snippet markers:<p>* If some lines of code are marked as being part of a chapter, but that chapter doesn&#x27;t have a &quot;^code&quot; marker to include them, it reports an error. This way I can&#x27;t accidentally drop code on the floor.<p>* It can generate a separate copy of the entire codebase that only includes the snippets that are in a given chapter (and the preceding ones). In other words it can output &quot;what does all the code look like by the time the reader reaches the end of chapter ___&quot; for every chapter.<p>I output the code for each chapter and then compile that and run all of the tests. This way, I can ensure that by the end of each chapter, the program supports what it&#x27;s supposed to support by then. I&#x27;ve found countless bugs doing this -- places where I inadvertently put code in a later chapter that is actually needed earlier.<p>However, this build script is <i>not</i> a generic &quot;build a book&quot; system. It&#x27;s a bespoke program that only supports this one specific book. That helps keep the complexity down and makes it much easier to put little hacks in when I run into weird edge cases my specific book has. I think that&#x27;s a reasonable trade-off to keep me producing a high-quality book without too much yak shaving.<p>One of the days, I&#x27;ll write a full blog post going through this in more detail.<p>Of course, none of this is a criticism of Thorsten&#x27;s system. The simple most important skill in writing a book is figuring how to get those pages done. It doesn&#x27;t matter if that means waking up at three in the morning and writing on parchment with a red pencil. Whatever works for you, works.<p>[1]: <a href="http:&#x2F;&#x2F;www.craftinginterpreters.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.craftinginterpreters.com&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;munificent&#x2F;craftinginterpreters&#x2F;tree&#x2F;master&#x2F;util" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;munificent&#x2F;craftinginterpreters&#x2F;tree&#x2F;mast...</a>
pjmlp将近 7 年前
Interesting that the language is called Monkey.<p>Garmin&#x27;s own programming language for device apps is called Monkey C.<p><a href="https:&#x2F;&#x2F;developer.garmin.com&#x2F;connect-iq&#x2F;programmers-guide&#x2F;monkey-c&#x2F;" rel="nofollow">https:&#x2F;&#x2F;developer.garmin.com&#x2F;connect-iq&#x2F;programmers-guide&#x2F;mo...</a>
评论 #17918255 未加载
runningmike将近 7 年前
I tried md, but go back to rst again. I tried many things, but all have some disadvantages. Outline of tools tried and considered on my blog at <a href="https:&#x2F;&#x2F;nocomplexity.com&#x2F;the-next-version&#x2F;" rel="nofollow">https:&#x2F;&#x2F;nocomplexity.com&#x2F;the-next-version&#x2F;</a>
gymshoes将近 7 年前
&gt; After nearly two years, I’m still a happy customer and the only two features I’d love to have are more payment methods and pricing per country, so I can set a lower price for readers in India, for example.<p>I think KDP allows setting different pricing for different countries.
netvarun将近 7 年前
There was an Ask HN recently on what tools to use to write a textbook - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17781569" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17781569</a>
tmaly将近 7 年前
I would love to see his Latex template for this as well as a few samples of markdown.<p>I wonder how well this method would work for something like an illustrated children’s book?
nwmcsween将近 7 年前
Hmm why not asciidoc or basically any other doc markup language? Most provide additional support for books.
评论 #17920813 未加载
评论 #17920200 未加载
jasode将近 7 年前
<i>&gt;, are written in GitHub Flavored Markdown (GFM) [...] code presented in the books is contained in the Markdown files in the form of fenced code blocks.</i><p>I understand the appeal of markdown but I avoid it for writing coding tutorials because it doesn&#x27;t have an easy way to <i>annotate</i> code with graphics like arrows and floating callouts. Here are some visual examples of code enhanced by arrows: [1][2][3]<p>Also, all types of text files besides programming syntax can also be explained with graphical annotations such as configuration files or log output files. E.g.[4]<p>Therefore, I use MS Word because it makes annotation easy. (LaTeX can also do annotation but that has its own workflow issues such as the typical programmer not knowing it which means the team can&#x27;t easily update the documentation.)<p>IMO, annotation is important because if we performed eye-tracking and heatmap tests with people reading code tutorials, we&#x27;d see that a significant amount of time is wasted with the eyes constantly shifting back and forth between the code and the subsequent paragraphs explaining that code that&#x27;s located a few inches down the page. I also think this is one reason why live coding demonstrations can sometimes be more effective than reading a book because the presenter is wiggling the mouse (or laser pointer) around the <i>exact</i> spot of the syntax while he&#x27;s talking.<p>This can be somewhat mitigated with adding <i>inline code comments</i> in the example but often, it still doesn&#x27;t point to the <i>exact</i> point in the line that needs to be studied. Code comments also don&#x27;t easily illustrate (because it has no spatial cues) how separate lines are related to each other.<p>One workaround of markdown&#x27;s limitation would be to rasterize the code&#x27;s text into an image and then use Photoshop to annotate. However, with MS Word, that cumbersome step isn&#x27;t required.<p>[1] <a href="https:&#x2F;&#x2F;introcs.cs.princeton.edu&#x2F;java&#x2F;11cheatsheet&#x2F;" rel="nofollow">https:&#x2F;&#x2F;introcs.cs.princeton.edu&#x2F;java&#x2F;11cheatsheet&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;www.oreilly.com&#x2F;library&#x2F;view&#x2F;head-first-python&#x2F;9781491919521&#x2F;figs&#x2F;web&#x2F;166fig02.png.jpg" rel="nofollow">https:&#x2F;&#x2F;www.oreilly.com&#x2F;library&#x2F;view&#x2F;head-first-python&#x2F;97814...</a><p>[3] <a href="https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;D8JeF.png" rel="nofollow">https:&#x2F;&#x2F;i.stack.imgur.com&#x2F;D8JeF.png</a><p>[4] <a href="https:&#x2F;&#x2F;csharpcorner-mindcrackerinc.netdna-ssl.com&#x2F;UploadFile&#x2F;1492b1&#x2F;restful-day-sharp6-request-logging-and-exception-handingloggin&#x2F;Images&#x2F;dynamic%20log%20file%20name.jpg" rel="nofollow">https:&#x2F;&#x2F;csharpcorner-mindcrackerinc.netdna-ssl.com&#x2F;UploadFil...</a>
danso将近 7 年前
How do people feel about Gumroad vs. Leanpub these days?
_emacsomancer_将近 7 年前
Is he writing them in GitHub web interface?
purplezooey将近 7 年前
screw writing an entire book in markdown. You&#x27;d have better luck writing it in troff for chrissake.
mstolpm将近 7 年前
Not much to see here despite some self promotion. It&#x27;s mostly not about writing but preparing for (self) publishing. In short: Markdown, pandoc and kindlegen.<p>Missing is everything about the writing process, structuring content and editing.
评论 #17917217 未加载
6stringmerc将近 7 年前
I take umbrage with calling these technical manuals &#x2F; instructional texts &quot;books&quot; due to the conflagration of the commonality of the term. Stephen King writes books. There&#x27;s no shame in calling a piece of text by its correct name.
评论 #17918791 未加载
评论 #17920244 未加载