Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 04-01-2011, 06:11 PM   #1
zaph0d
Junior Member
zaph0d began at the beginning.
 
Posts: 3
Karma: 20
Join Date: Apr 2011
Device: Kindle
Preserving Indentation

To Whom it may concern!
I've been trying to convert "The C Programming Language Ritchie & kernighan" from PDF to mobi and all the time I get the code blocks stripped of the indentation - really ugly.
Finaly I came up with some sort of solution

Settings->Conversion->Common Options->Search and replace

Search: [\s]{2}
Replace:   

It may not be very elegant but it works ))

Now this:
Code:
main()
21
{
int c, nl;
nl = 0;
while ((c = getchar()) != EOF)
if (c == '\n')
++nl;
printf("%d\n", nl);
}
became this:

Code:
    main()
21
    {
        int c, nl;
        nl = 0;
        while ((c = getchar()) != EOF)
            if (c == '\n')
                ++nl;
        printf("%d\n", nl);
    }
Another trick

Table of contents in pdf files turns to something like this:
1.5.2 Character Counting.......................................... ........................................19
1.5.3 Line Counting.......................................... .......................................20
1.5.4 Word Counting.......................................... ..................................21

which gets carried over 2 lines.. very ugly
So, put another replacement:
Search: \.\.\.\.\.\.\.\.\.\.\.\.\.\.\.
Repace: <EMPTY>

Cheerz
zaph0d
zaph0d is offline   Reply With Quote
Old 04-02-2011, 08:42 AM   #2
zaph0d
Junior Member
zaph0d began at the beginning.
 
Posts: 3
Karma: 20
Join Date: Apr 2011
Device: Kindle
Okay, PDF->EPUB(calibre), Sigil, than calibre again EPUB->MOBI seems to be a bit better, I cleared page numbers and generated proper TOC in Sigil, but its kinda too exhaustive for a personal conversion... and Im not publisher/writer

I hope, the new PDF engine is coming soon, are there alpha/beta builds I can download for personal use?
zaph0d is offline   Reply With Quote
Old 04-02-2011, 12:54 PM   #3
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,433
Karma: 950001
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by zaph0d View Post
I hope, the new PDF engine is coming soon
No. It is stalled. Meaning no one is currently working on it.

Quote:
Originally Posted by zaph0d View Post
are there alpha/beta builds I can download for personal use?
No, it is not yet in a usable state. With a little work it can be used to produce XML output but the code to turn that into something usable is missing.
user_none is offline   Reply With Quote
Old 04-02-2011, 08:52 PM   #4
zaph0d
Junior Member
zaph0d began at the beginning.
 
Posts: 3
Karma: 20
Join Date: Apr 2011
Device: Kindle
Can I help?
zaph0d is offline   Reply With Quote
Old 04-02-2011, 08:58 PM   #5
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,433
Karma: 950001
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by zaph0d View Post
Can I help?
Of course. Take a look at http://bazaar.launchpad.net/~kovid/c...re/ebooks/pdf/ Post on the https://launchpad.net/~calibre-devs mailing list for help. Kovid is the one working on the C code so he's the most knowledgable about it.
user_none is offline   Reply With Quote
Old 05-30-2011, 04:41 PM   #6
bedalton
Junior Member
bedalton began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jul 2010
Device: Android
Thanks for the tip Zaph0d, worked like a charm.
bedalton is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert epub that has hard margin / indentation? planetthoughtful Conversion 5 02-08-2011 05:37 AM
PDF to epub convertion grief; keeping indentation Aia Calibre 2 10-31-2010 05:09 PM
Preserving Formatting through conversion? Ham88 PDF 16 08-31-2009 02:22 AM
Epub and negative indentation Nate the great ePub 6 04-27-2009 11:48 AM
PDF conversion & indentation Shiren Calibre 5 12-11-2008 02:09 PM


All times are GMT -4. The time now is 12:48 AM.


MobileRead.com is a privately owned, operated and funded community.