1

I am trying to format a label in two languages in a way they appear on one line and not stacked in ArcGIS any ideas? Maplex Stacked label feature is not ticked so this does not help. This is how they currently appear when labelled with the following python code:

River Corrib
Abhainn Na Gaillimhe

def FindLabel ([ENG_NAMED_RIVER], [GLE_NAMED_RIVER], [GAELTACHT_AREA]):
    try:
        s =[ENG_NAMED_RIVER]
        s = s.title().upper()

        if ([GAELTACHT_AREA]) == "Y":
            return "<ita>"  +  ([GLE_NAMED_RIVER]) + "</ita>"
        elif ([GAELTACHT_AREA]) == "N":
            if [GLE_NAMED_RIVER] is None and [ENG_NAMED_RIVER] is not None:
                return (s)
            else:   
                return (s) + '\n' + " " + "<ita>"  +  ([GLE_NAMED_RIVER]) + "</ita>"
    except AttributeError:
        pass

But I just want the label to read like:

River Corrib Abhainn Na Gaillimhe

  • Welcome to GIS StackExchange! As a new user, please take a few minutes to take the Tour. I also recommend checking out the formatting options for posts to ensure that your code comes through clearly on any future questions. – smiller Jul 12 '18 at 13:28
2

The \n is a newline character, so it automatically creates a second line at that point. Remove it from the line return ( s ) + '\n' + " " + "<ita>" + ( [GLE_NAMED_RIVER]) + "</ita>".

  • Quick reminder: If this works as a solution for you, please remember to come back and mark it as a helpful (vote up) and/or accepted answer (checkbox). – smiller Jul 12 '18 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.