How do I get paragraphs to follow the indention of Headings?

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
benm_130
Propeller Head
Posts: 34
Joined: Thu Aug 18, 2011 7:42 am

How do I get paragraphs to follow the indention of Headings?

Post by benm_130 »

I would like to be able to use the "Use TOC depth for heading levels" for my document, but the text following the headings does not indent with the heading.

This is what I end with in my output:
Capture.PNG
You do not have the required permissions to view the files attached to this post.
Last edited by benm_130 on Wed May 29, 2013 9:05 am, edited 1 time in total.
whunter
Sr. Propeller Head
Posts: 429
Joined: Thu Mar 12, 2009 4:49 pm
Location: Portland, OR

Re: How do I get paragraphs to follow the indention of Headings?

Post by whunter »

That is not what "Use TOC depth for heading levels" does. That setting is used to dynamically adjust the heading levels in your output based on the level in your TOC. For example, the first heading in your top level TOC topics will always be H1, regardless of what it actually is in the file, the first heading in your second level TOC topics will always be H2, and so on.

I'm not aware of any way to dynamically adjust the paragraph text based on heading indentation. You would need to create different styles for the different levels of indentation.
benm_130
Propeller Head
Posts: 34
Joined: Thu Aug 18, 2011 7:42 am

Re: How do I get paragraphs to follow the indention of Headings?

Post by benm_130 »

Hmm. Seems like there should be some way to make everything after that heading have the same indentation level as the heading. As it is, I went into the stylesheet and set each heading to indent a little more than the one above it, expecting the ensuing paragraph to follow.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: How do I get paragraphs to follow the indention of Headings?

Post by LTinker68 »

No. The cascading part of Cascading Stylesheets deals with parent/child relationships. A heading and a paragraph are sibling tags, not parent/child, so the styles don't cascade (inherit) from each other (they both cascade/inherit from the <body> tag). An example of a parent/child set is an ordered list -- the parent is the <ol> tag and the children tags are the <li> tags. Another example is <td> is a child of <tr> which is a child of <table>.

I don't think a complex selector would help you in this case, because they have limited scopes. For example, you could add a complex selector to the stylesheet that controls how a paragraph behaves when it follows a heading tag, but it would only affect that first paragraph; all subsequent paragraphs would resort to the default paragraph style. (Although I'm not familiar with all complex selector types, so I could be wrong about that.)

What you would need to do is use something like a div that would be used to group all the content after the heading. For instance, you could add div.h2Content to the stylesheet that has margin-left set to 20px or .5 in or whatever. You'd then put your paragraphs and tables inside that div. You could also set up a complex selector that automatically inserts a div with class "h2Content" immediately following an h2 tag so your structure is set up automatically after you add an h2 tag.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
IFU
Propeller Head
Posts: 48
Joined: Tue Dec 05, 2017 5:28 pm
Location: Vancouver BC

Re: How do I get paragraphs to follow the indention of Headi

Post by IFU »

Just wondering whether there is any new information on this topic. I've been asked to do just that - dynamically adjust the indent of the body text based on heading indentation or TOC depth - and have not come up with anything. Thanks. Isabelle
doloremipsum
Sr. Propeller Head
Posts: 290
Joined: Mon Aug 26, 2019 2:11 pm

Re: How do I get paragraphs to follow the indention of Headi

Post by doloremipsum »

I haven't tried this myself, but mayyybe you could use sibling combinators, i.e. the + / ~ symbols. It seems that the + refers to just the sibling directly before, while the ~ refers to all adjacent siblings. So you could do something like this:

Code: Select all

h2 ~ p
{
    margin-left: 6pt;
}
This means that all p's that are siblings of an h2 will have that indentation. There will be more to it than that - you will also need to define the margins for lists, divs, images and anything else you might want to have under your h2.

Alternatively, you could try this:

Code: Select all

h2 + div
{
    margin-left: 6pt;
}
This will make a div that directly follows your h2 have the margin, and in turn anything inside that div will inherit the margin. This might actually be the simpler option, because you won't need to anticipate everything you might put under an h2 and add it to the stylesheet - but you do need to remember to encase everything under every heading in a div. So YMMV!

The benefit of both of these approaches is when the heading level is adjusted (by the TOC), the margins *should* adjust as well with no input from you. I hope!
in hoc foro dolorem ipsum amamus, consectimur, adipisci volumus.
IFU
Propeller Head
Posts: 48
Joined: Tue Dec 05, 2017 5:28 pm
Location: Vancouver BC

Re: How do I get paragraphs to follow the indention of Headi

Post by IFU »

Thank you! Both approaches work beautifully. Isabelle
88Schwind
Propeller Head
Posts: 20
Joined: Mon Sep 20, 2021 8:05 am

Re: How do I get paragraphs to follow the indention of Headi

Post by 88Schwind »

This is driving me nuts. There is no way that something as simple as indentation of a style should be so difficult. I have an ordered list, but I want to create a style called stepresult. I want it to align with the text (not the number) of the previous step, and I don't need this particular item numbered. How can I make it so #4 is not counted as part of the ordered list and so the text aligns with the S in Step 3?
You do not have the required permissions to view the files attached to this post.
robdocsmith
Sr. Propeller Head
Posts: 247
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: How do I get paragraphs to follow the indention of Headi

Post by robdocsmith »

I think what you're asking is to add follow on paragraphs to your list element. I see you've already got your lists as paragraph items (think that's now the default) in that they go <li><p>List text in here</p></li>.
If you put your cursor at the end of item and hit return, you get a new list item, then immediately hit backspace. The item should turn into a paragraph indented with your list text. If the indent doesn't line up you may have to play with the css a little.
Your list item will look like <li><p>List text in here</p><p>Follow on paragraph</p></li>.

If you've a list that doesn't have paragraph tags, you can turn them into paragraph items by clicking the little spanner/document icon in the Paragraph section of the Home ribbon. Choose Make Paragraph Item, and each list element should get a paragraph tag inside it.

Rob
Shredder
Propeller Head
Posts: 43
Joined: Fri Sep 18, 2020 4:42 am

Re: How do I get paragraphs to follow the indention of Headi

Post by Shredder »

88Schwind wrote:This is driving me nuts. There is no way that something as simple as indentation of a style should be so difficult. I have an ordered list, but I want to create a style called stepresult. I want it to align with the text (not the number) of the previous step, and I don't need this particular item numbered. How can I make it so #4 is not counted as part of the ordered list and so the text aligns with the S in Step 3?
Hi!

You have three options.

Option One
Use the "indent item" button in the "Paragraph" part of the toolbar, under the "Home" tab.

Option Two
Create a custom list format. You can find the steps here: https://help.madcapsoftware.com/flare20 ... ormats.htm

I created a custom list format for task steps that looks like this:
steplist.png
Originally, I wanted to use  for step results, however that made Flare crash, apparently it is a bug associated with . So I chose  instead.

Option Three/b]
Use an XML editor like OxygenXML, write in DITA, import DITA in MadCap Flare.
You do not have the required permissions to view the files attached to this post.
Nita Beck
Senior Propellus Maximus
Posts: 3667
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: How do I get paragraphs to follow the indention of Headi

Post by Nita Beck »

Shredder, I think you are taking 88Schwind far afield.

robdocsmith has offered the correct solution, which is to use paragraphs within list items.

88Schwind, you can find the solution covered in Flare's help: https://help.madcapsoftware.com/flare20 ... -Items.htm

You shouldn't have to create and apply any special style for the paragraphs you want to align.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Shredder
Propeller Head
Posts: 43
Joined: Fri Sep 18, 2020 4:42 am

Re: How do I get paragraphs to follow the indention of Headi

Post by Shredder »

Nita Beck wrote:Shredder, I think you are taking 88Schwind far afield.

robdocsmith has offered the correct solution, which is to use paragraphs within list items.

88Schwind, you can find the solution covered in Flare's help: https://help.madcapsoftware.com/flare20 ... -Items.htm

You shouldn't have to create and apply any special style for the paragraphs you want to align.
Quite on the contrary. If you need to comply with harmonised norms for the EU, it is recommended to use a symbol for what would be a step result in DITA. My company has to comply with EN 82079-9:2019 (or ISO/IEC/IEEE 82079-1:2019) and EN 20607 "Safety of Machinery". Thus, the manuals must indicate the expected result. Symbols commonly used are the Unicode equivalents of the various Wingdings arrow and finger-pointing symbols.

However, for non-complex (consumer) products or software it may be sufficient to simply indent the list item.

For example, compare the step result style for the Ecostrip (which won the Tekom Doku Award). Screen grab below.
You do not have the required permissions to view the files attached to this post.
Nita Beck
Senior Propellus Maximus
Posts: 3667
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: How do I get paragraphs to follow the indention of Headi

Post by Nita Beck »

Sounds like yours is a special use case, and I'll defer to you as the knowledgeable compliance expert. Based on the screenshot that 88Schwind posted to illustrate their use case, I think that nested paragraphs are all that are needed.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Post Reply