I'm trying to figure out a way to draw a box around characters to indicate certain keyboard actions. For example, I'd like to draw a box around CR to indicate Carriage return and LF for line feed. I need to include these this kind of thing a number of times throughout the document. I was trying to use a table (which might work) or text frame but thus far, I couldn't get it the way I wanted. Plus, I was hoping that there might be an easier way to do it.
Here is an example of what I am trying to do. Any help is greatly appreciated.
There are two options.
Both of these will probably require some fiddling with the spacing between lines to prevent overlap, but Frame does a fair job of handling that if you make sure that the paragraph tag does NOT have Fixed line spacing selected.
Thank you for the help. I'm going to try your first suggestion and see how works.
Hmmm. Looking at the preview for keycaps, it doesn't appear to have anything like CR or LF as a character. So it looks as if your option is to create a graphic that can be inserted using the image insert. Sorry about that.
What's the semantic context here?
I haven't seen a keyboard with a LineFeed cap since the ASR 33 teletype, and don't ever recall seeing one that had a Return/Enter key actually labeled "CR" or "CarriageReturn". The only key usually seen nowadays is "Enter↵" (and even that will vary by localization).
When I've had this requirement, I usually rely on a keycap-style font, or use a custom embedded vector graphic enclosing actual text (Frame graphics or SVG).
In a Unicode future that may not be near us, and a suitably populated font, the literal enclosed CR and LFs might be implemented with:
U+240D SYMBOL FOR CARRIAGE RETURN
U+240A SYMBOL FOR LINE FEED
U+20E3 COMBINING ENCLOSING KEYCAP
You might also create a character style and set a background.
This would also highlight your characters.
Thanks for the reply Bob. I will have to take a look and see the reasons for requiring carriage return etc. I'd rather use something a bit more up to date if I can.
Copy link to clipboard
*I noticed my first screen capture didn't show the character designer settings. I've updated to include the settings I used in the example.
Here's an example, using Winfried Reng's suggestion of using a character tag to control the "box" and the color of the text. Note that because LF has both a leading and trailing space, Smart Spaces needs to be turned off in Format > Document > Text Options, or you need to place the LF and character tag in a variable.
While this doesn't have a box around the characters like your example, the text and background color can be whatever you want.
Placing the text and character tag in a variable would also give you an easy way to quickly and consistently insert the codes you need.
Thank you Matt. I've never used this feature before. I'll give it a try.
did you get something usable?
Yes. I ended up going with a dark colored background and white text and it seems to serve the purpose. My LF box did not have spaces before and after the letters so I did not need to turn off Smart Spaces. The only small issue with this method is that when the boxes were side by side, I had to leave space between them so that it looks like they are separate.
That being said, it certainly does the trick for my purposes.
Thanks for checking up.