View Single Post
Old 06-24-2013, 03:24 PM   #1
il_mix
Enthusiast
il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.il_mix can self-interpret dreams as they happen.
 
Posts: 39
Karma: 20178
Join Date: Jun 2013
Device: Kobo Touch
HTML to ePUB with monospace font

Hi everyone!

I'm testing a frined's Kobo Touch, looking if it suits my needs.
I have many HTML and PDF documents about programming. I managed to do a not-so-bad conversion from PDF to HTML, so I'm interested the most in the last step of the conversion to ePub.

Well, I'm not able to get the code section to be displayed in monospace font. I made many tests. Here is the one that (I think) is closer to the right solution. Here is my HTML:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>

<head>
<title>Book title</title>
<meta name="author" content="someone"/>
<style type="text/css">
body {
  font-family: Sans-serif;
}
pre {
  background: #eeeeee;
}
code {
  font-style: monospace;
}
</style>
</head>

<body>
<h1><b>1 My chapter</b></h1>
<h2><b>1.1 Introduction</b></h2>
<p>Here is a line with normal font.</p>
<p>Here is another one.</p>
<pre><code>for(int i = 0; i < 100; i++) {
  printf("Why the hell it's not monospace?");
}</code></pre>
<p>That's all folks!</p>
</body>
</html>
I've set nothing in particular in the conversion settings.
I've tried embedding Courier New, but than anything become Courier New EXCEPT for the code section...

Any hints?
Thanks!
MIX
il_mix is offline   Reply With Quote