如何编写「anni '90」?以及如何在LaTeX中输出「anni '90」?
Hey there! Let's tackle your two questions about getting anni '90 just right—whether you're writing it as a regular string or typesetting it in LaTeX.
anni '90 string in general code/text This is straightforward most of the time! The string itself is made of plain ASCII characters, so you can type it directly unless you're using a programming language where single quotes act as string delimiters.
- For languages that use double quotes for strings (like Python, Java, C#), you can write it directly without any extra steps:
favorite_decade = "anni '90" print(favorite_decade) # Outputs: anni '90 - For languages that use single quotes as string delimiters (like JavaScript, PHP), you'll need to escape the internal single quote with a backslash to avoid breaking the string:
let favoriteDecade = 'anni \'90'; console.log(favoriteDecade); // Outputs: anni '90 // Alternatively, wrap the string in double quotes to skip escaping entirely: let favoriteDecade2 = "anni '90";
No fancy hacks needed here—just keep an eye on how your programming language handles string boundaries!
anni '90 correctly in LaTeX LaTeX has a quirk with single quotes by default: it uses backticks (`) for left curly quotes and apostrophes (') for right curly quotes. But if you want the straight single quote from your original string, here's how to nail it:
Option 1: Direct input (works for modern engines)
If you're using a modern LaTeX engine like XeLaTeX or LuaLaTeX (which handle UTF-8 natively), just typinganni '90in your.texfile will usually output the straight single quote correctly.Option 2: Force a straight single quote
If you're using an older engine (like pdfLaTeX) or your default font keeps turning the quote curly, use the\textquotesinglecommand to explicitly output the exact character you want:anni \textquotesingle 90This guarantees no curly quotes sneak in where you don't want them.
Quick note: Avoid typing anni `90 (with a backtick)—that will produce a left curly quote, which isn't the formatting you're after.
内容的提问来源于stack exchange,提问作者andreYLLI

