Formatting poetry

Previous topic - Next topic


Greetings to all! I wonder, if anybody found the solution to properly indent a poetry piece of an arbitrary length. Like:

lineone line one line one
     linetwo line two line two
linethree line three line three
     linefour line four line four  ...and so on

I imagine creating a style with the second line indented, but that means you must apply it to every other line, which is still quite laborious with a longer piece. Maybe a script could be created for the purpose? Ideas, suggestions are very welcome!


The simple solution is maybe to add a tab at the start of every second line?


did you try and change the indents?
it can be a little tricky, you have to type the values in, the slider things are a little janky.


Thank you all who responded!
I did with tabs on second line, manually.
I also experimented with the second line indents and creating a style for that. It is better in a sense, but still a lot of manual work.
I am lazy! Thus looking for some sort of automated solution, like select a piece, apply a style or run a script and Voila! magic formatting happened!
But maybe it is not such a big deal, since rarely a poetry book is that huge... and it is easier to live with the manual setting of it.


hi sersha

in my eyes, using the tabs is rather a good idea.

but you mentioned that a script could also apply the styles and here is a script that does it:

- just apply the paragraph style to the first n paragraphs in the frames
- select the n paragraphs
- run the script to apply the style from the selection to the rest of the frame

    import scribus
except ImportError:
    print('This script must be run from inside Scribus')

def main():
    if not scribus.haveDoc():
        scribus.messageBox('Error', 'You need to have a document open')

    if scribus.selectionCount() == 0 or scribus.getObjectType() != 'TextFrame':
        scribus.messageBox('Error', 'You need to select a text frame')

    # get current selection
    selected_text = scribus.getFrameText()

    scribus.selectFrameText(0, 0)

    frame_text = scribus.getFrameText().strip('\r')
    if len(selected_text) == len(scribus.getFrameText()):
        scribus.messageBox('Error', 'There is no selection in the text frame')
        # no text selected

    paragraphs_count = selected_text.count('\r') + 1

    frame_paragraphs = frame_text.strip('\r').split('\r')

    styles = []
    start = 0
    for paragraph in frame_paragraphs[0:paragraphs_count]:
        scribus.selectFrameText(start, len(paragraph))
        start += len(paragraph) + 1

    for i, paragraph in enumerate(frame_paragraphs[paragraphs_count:]):
        scribus.selectFrameText(start, len(paragraph))
        scribus.setParagraphStyle(styles[i % len(styles)])
        start += len(paragraph) + 1

    scribus.selectFrameText(0, 0)
if __name__ == "__main__":


btw, it looks like this: