Use an Ubuntu Compose Key for Occasional Accents and Macrons
A Compose key lets you enter a special character as a short sequence of ordinary keys. It can suit occasional names or words with accents and macrons while leaving your usual keyboard layout in place. The resulting character still needs a quick check in the destination application.
Choose a key deliberately
In Ubuntu's documented GNOME desktop settings, open Keyboard and look for Compose Key. Enable it and select an available key. Check what that key currently does in your working applications before giving it a new role; a rarely used key on one keyboard may be essential on another.
Open a plain text document for a harmless test. Press and release the chosen Compose key, then enter the sequence for the character. Ubuntu gives Compose, apostrophe, e as an example for é, and Compose, hyphen, e for ē. These are sequential presses, not a requirement to hold all the keys together.
Type a short test word containing both ordinary letters and the composed character. Check that the next normal keystroke behaves as expected and that your original input layout remains selected. If the Compose setting is absent, identify the desktop and input method before following instructions for a different environment.
Verify the receiving field
Copy or type the test into the application where the real text will be used. Inspect the actual letter, not just the presence of a mark above it. Similar-looking characters, a detached combining mark or a replacement square can make a name difficult to search later.
Save the harmless document, reopen it and check the same word. For a website form, test in an unsent draft or other safe field first; its validation rules may differ from a text editor's capabilities.
If the assigned key interferes with a shortcut you rely on, return to the Compose setting and select a different key or disable it. Keep the sequence you actually verified with your working notes so that occasional character entry remains predictable.
Sources: Ubuntu documentation.