Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Object Style – Center

Return to Member Forum

  • Author
    Posts
    • #57914
      soulartist
      Member

      I would like to create an object style that would center the object (a graphic in this case) within the text frame.

      Although I can center the graphic by aligning horizontal center from the application bar, I don't see centering as an option for an object style.

      Is there a way to do this?

      Thanks,

      Eden

    • #57918
      jpannier
      Member

      Hi Eden,
      I'm not quite sure if I get your question right. There's no alignment feature within the object style. But if you want to align a floating (embedded) image within a text you have to create a special paragraph style. Then you can insert the graphic, select it with your text tool and apply the paragraph style.
      This technique works very well within an ePub workflow because you can later control the images via CSS.

      Hope, this helps.
      Jeldrik

    • #57920
      soulartist
      Member

      Hi Jeldrik:

      Yes, you understand my question, and ePub is what I have in mind.

      1) What steps are necessary to create a center only paragraph style?

      2) How can I select the graphic with the text tool? Are you referring to an anchored inline object that you cut, then paste, and then center?

      Thanks,

      Eden

    • #57928
      jpannier
      Member

      Hi Eden,
      1) To create such a style, take the paragraph style of your bodytext and duplicate it. Then set the alignment to center and adjust the space before and after (if necessary). AND here’s the trick: Set the leading value to “Auto”. This is the only time when auto leading makes sense. Now the image will take as much line height as it needs.

      2) Yes, I’m talking about an inline anchored object. You can select any inline graphic just like text. So place the cursor before (or after) the object hold down the shift key and move the arrow key – sometimes this is easier as using the mouse.

      3) Be careful, that the image and the style are only applied on this one single paragraph. Then you have better control in the ePub when defining the CSS style of the image paragraph (space before and after)

      Jeldrik

    • #57945
      soulartist
      Member

      Hello Jeldrik:

      I appreciate the clarification.

      I followed your instructions. When I view my test doc in ADE or Calibre, the graphic remains to the left margin, and isn't centered.

      Here's the css for that style. I also included Op5 space before and after, but that doesn't appear to show up on this code.

      } margin: 0.56em 0em; color: #000000; text-align: center; text-indent: 0em; font-variant: normal; text-decoration: none; line-height: 1.20em; font-size: 0.75em; font-style: normal; font-weight: normal; font-family: “Adobe Caslon Pro”;p.center-object-style }

      Thanks,

      Eden

    • #57952
      jpannier
      Member

      Are you sure that the paragraph and the class name of the CSS really match? Take a look at the xhtml file and look for this specific piece of code. To have something to compare – maybe this ePub will help you. https://www.synp.net/fileadmin/…..-2010.epub It’s in German but just look for the images and the particular code and the corresponding CSS.

      Jeldrik

    • #57966
      soulartist
      Member

      Hello:

      Here's what I see in the xhtml file; the art caption and the graphic are grouped. From this, I don't see how how they match either, but then again, I'm a novice in this regard.

      <p class=”art-caption” xml:lang=”en-us”><span class=”no-style-override-4″>Okyo</span> </p>

      </div>

      <div class=”generated-style-2″>

      <img class=”generated-style-2″ src=”images/okyo_fmt.jpeg” alt=”missing image file”/>

      </div>

      Also, the sample link you provided get garbled into some sort of strange code:

      PK5'=O§W¥ýMETA-INF/container.xmlU?Á
      Â0Dï…þCÈUjô‚g¿`M·L²!IEÿÞX´ØãÎμ™¶{:Ë“!¯øv½áÝ®®êªÕä3qùeÅï“âcô’ ™$=8L2kI}Ozt賜lr†ð

    • #57976
      jpannier
      Member

      Hi Eden,
      what I can tell you is, that your image isn’t part of a paragraph. Here’s an example:
      <p class=”inlineobjekt”><span class=”bildinlineobjekt”><img alt=”Rath_Ackermann.jpg” class=”bildinlineobjekt” src=”../Images/Rath_Ackermann.jpg” /></span></p>

      The important thing is the p class.

      with the corresponding CSS:

      p.inlineobjekt {
      font-family: serif;
      line-height: 1.19em;
      font-size: 0.88em;
      margin-bottom: 2.00em;
      margin-top: 2.00em;
      text-indent: 0.00em;
      margin-right: 0.00em;
      margin-left: 0.00em;
      text-align: center;
      font-weight: normal;
      font-style: normal;
      color: rgb(0,0,0);
      width: auto;
      }

      Here some good sources:
      Liz Castro with her book about ePub:
      https://www.pigsgourdsandwikis.com/

      Cari Jansen has a lot of tipps too:
      https://carijansen.com/

      For editing an ePub-file try sigil:
      https://code.google.com/p/sigil/

      Hoping all the links are working. If not, send me an email j.pannier@synp.net
      Jeldrik

    • #58007
      jpannier
      Member

      Why the object did not centered!

      To give this thread a good ending. Here the result after examination of Eden’s file.

      Problem:

      An inline graphic did not align centered after the export to ePub even though an extra paragraph style was applied to it.

      Reason:

      The image was grouped with its caption and then placed as inline object. To group images and captions makes sense especially when using the (live) caption feature of ID or when arranging two images with captions beside each other. But during the export to ePub InDesign skips the applied paragraph style because it detects a group – don't ask me why. This is the reason why the xhtml-code states “div class= “group””. Now you have two ways to deal with this issue:

      a.
      You group the image and the caption as before. Then apply an object style (e. g. inlineImage) to this group. After export to ePub the xhtml-code will state “div class=”inlineimage”. Because of the defined object style you'll find an empty style within the CSS file “div.inlineimage”. Now you can tweak the CSS file and ad “text-align: center;” to the div.inlineimage entry. Now the image should be centered. Furthermore you have to change the alignment for the caption as well.

      b.
      If you only want to place one image with one caption you don't group the image and the caption. So you don't have to create an object style and InDesign will interpret the image as part of a paragraph.

    • #58014
      soulartist
      Member

      Hi Jeldrik:

      Many thanks for going the extra mile in helping me to resolve this technique.

      Putting my ePub together is a puzzle, which I'm slowly putting together.

      Be well,

      Eden

Viewing 9 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads