Formatting techniques

Topics: User Forum
Nov 29, 2011 at 8:47 AM

I'm trying to format the pages of a CHM file to look nice ( to me).
I figured out most of the things I want, but wanted to check that I'm doing things the right way.

I started with the Prototype style and hacked from there.

(1) Formatting of fonts, sizes, colors.
Looks like this is done by editing presentation.css. But it was a trial-and-error process for me.
How can I figure out which items in the css file refer to which items displayed on the page ?
Some are obvious, but many are not (to me, anyway).

(2) Removing items
I wanted to remove the productTitle item and the version/assembly info.
I did this by commenting out "include item" references in utilities_reference.xsl.
Is that the right way to do this ??

(3) Spacing in the Members tables
My tables have extra space ("padding", I suppose) at the bottom of each cell.
How do I get rid of this ?

(4) Copyright text
I'd like to include some special characters in my copyright text. How do I do this ?

 

thanks very much

 

bk

 

 

Coordinator
Nov 30, 2011 at 8:26 PM

Changing the fonts, sizes, and colors is done through the Presentation.css file.  If you're not sure what to modify, look at the HTML for a generated page, find an element that you want to change and see what style it or its parent element is using.  To remove items from the resource files you should just delete their content rather than commenting them out.  Commenting them out will just result in a lot of warnings during the build and potentially unwanted or incorrect elements in the rendered topics.  You could also track down the parts of the XSL transformations that use those elements and remove the XSL that renders them to get rid of them completely in some cases.  The table styles would also be controlled through the Presentation.css file.  You just need to track down or add an appropriate style element to adjust it.  The CopyrightText property value is treated as plain text.  The value will be HTML encoded where necessary to resolve issues related to the ampersand character and the XML parser.  In addition, you can encode special characters such as the copyright symbol using an escaped hex value (i.e. (c) = \xA9).

Eric

 

Dec 1, 2011 at 10:50 AM

Thanks very much for your help.

A few other questions/comments ...

> To remove items from the resource files you should just delete their content rather than commenting them out. 

Sorry to be dense, but I'm not sure what you mean by "the resource files".
Do you mean the files named xxx_content.xml in the "content" folders, or
do you mean the files named xxx.xsl in the "transforms" folders ?

> You could also track down the parts of the XSL transformations that use those
> elements and remove the XSL that renders them to get rid of them completely in some cases. 

I guess that's what I did -- I commented out some "include item" calls in utilities_reference.xsl,
and that seemed to work. But your first approach makes more sense to me. I'll give it a try.

> you can encode special characters such as the copyright symbol using an escaped hex value (i.e. (c) = \xA9).

Actually, the copyright character worked without any escaping, but the escaping trick will be
invaluable for other things.

I feel bad asking such basic questions. Is there somewhere I should have found this information
for myself ?  I did look, but was not successful.

Thanks again.

Coordinator
Dec 1, 2011 at 8:39 PM

By resource files I mean the content item files in the .\Content folder under each presentation style.  Note that SHFB overrides many items using it's own resource files found in the .\SharedContent folder under the SHFB installation folder.  If you have questions about property usage or other features of SHFB, refer to the SHFB help file.  The info about the encoding behavior of the CopyrightText property is included in there in the property description.  There's also a FAQ topic that covers many common issues and questions.

Eric