MapInfo Pro

MapInfo Monday: Text in Layouts

  • 1.  MapInfo Monday: Text in Layouts

    Posted 20 days ago
    Edited by Peter Horsbøll Møller 20 days ago

    Happy #MapInfoMonday,

    In this post, I will dig a bit into adding texts to the layout in MapInfo Pro.

    Here's a quick look at how a layout can look once you have added some texts and Smart Texts to it.

    MapInfo Pro allows you to add two types of texts to your layout. You can add a basic static text where you manually enter the value that you want the text to show. And then there is the a bit more advanced dynamic text that we refer to as a Smart Text

    The Smart Text is basically a MapBasic expression that dynamically returns a value that may change over time. One example could be the current date or current time stamp. But a Smart Text can also refer to a map or a layer inside MapInfo Pro.

    To make it easier to reuse Smart Texts, we have create Smart Text Aliases that are stored in a file. These Aliases lets you use a name to refer to a MapBasic expression which makes it easier to use these. With MapInfo Pro v2021, we made it even easier to use these Smart Text Aliases as we now show these in the Text dropdown on the Layout tab.

    Let's start from the beginning with a layout that you already have added some maps to. we have added a black rectangle where we want to add some text elements to.

    Adding a Text to your Layout

    From the Text dropdown on the Layout tab, select the Text option and then click in the layout window where you want to insert the text

    The cursor will now start blinking inside a new text frame and you can enter the text you want to add using the keyboard. Below, you can see that I have inserted a copyright message.

    This is an example of a static text manually entered by the user.

    With the Text Frame selected, you can quickly modify the text font. On the Layout tab, use the Style controls to change the font, the size, or use the Increase or Decrease Font Size controls to quickly change the size of the text in the selected text frame.

    You can edit an existing text by double-clicking on the text frame. This places a cursor in the text and makes it possible for you to edit the existing text or add additional text to it.

    Adding a Smart Text to your Layout

    Let us take this to the next level by inserting a Smart Text into the layout. It's always good to include a date to your layout so that you can see when the map was printed. You can do this by manually entering the date you want to display. The problem with this is that you need to remember to change the date if you print your layout again tomorrow.

    Let's add a Smart Text instead that automatically changes the date. From the Text dropdown, select Date in the list of Smart Texts. Now click in the layout where you want to insert the date.

    A Smart Text has two states. When you edit the Smart Text, you can see the expression used by the Smart Text. The Smart Text can start with the dollar sign ($) follow by the curly brackets ({}). This is for a Smart Text Alias. The Smart Text Alias is inside the curly brackets. In the example below, I'm the Smart Text alias Date.

    If I was creating my own Smart Text expression, and not using a Smart Text Alias, the Smart Text should start with $mb follow by the curly brackets. The expression inside the curly brackets would now be a MapBasic expression or function.

    When you are done editing the Smart Text, the expression will be evaluated and the result of this evaluation will be shown in the layout.

    If you want to learn more about Smart Texts, you should read this post I wrote after an earlier webinar where we covered Smart Texts in more details. I'll try to get the recording posted to our MapInfo YouTube playlist.

    Are you already taking advantage of the benefits that Smart Text, and texts in general, bring to your layout?

    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data