I'd like to do the following in latex (it's being fed to pandoc for conversion) I use the mainfont and mainfontoptions in pandoc

I have a piece of text on top that I'd like centered, and set to the the fonts specified in the command line.

The rest of the text, I'd like it to just be the default.

If I put in something like:

\centering Text

It centers fine, but also centers the rest of the document. It also doesn't use the font I want to use.

If I do

# Text

It uses the font (and makes it bold) but doesn't center. Ideally, I'd like to figure out some way to do a one-line \center and #.

  • 2
    # used this way is definitely not LaTeX. Maybe you wanted to use {\centering\Huge Text\par}, or \begin{center}\Huge Text\end{center}. – frougon Apr 5 '20 at 22:08

It appears that I can do:


and get what I want

  • I'm afraid this is not very good. 1) \large will affect whatever comes after it. 2) \centerline is from plain TeX, not LaTeX (sometimes, this can be acceptable, though). 3) The scope of \Huge is not limited here (though \large will override it). See my suggestions above—I hope they work in your system. – frougon Apr 5 '20 at 22:11
  • THe above works, but prevents the line from line-wrapping, whereas using \begin... /end wraps it up. I actually want the rest of the text large, anyway, so no big deal. Thx – Rory Toma Apr 6 '20 at 2:28
  • It would be better to use \centerline{\Huge text}{\large other text}. – user30471 Apr 6 '20 at 2:41

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.