1

How would I implement this as a \newcommand

\LARGE
\ <Text>
\Large

Document class is a article. Essentially what I am aiming for is to use a command such as \formatlarge{<text>} that would output it as \LARGE.

This would be easier than just typing

\Large

This is a heading

\large

Information relating to the heading
  • Welcome to TeX.SX! Please help us to help you and complete your code to provide a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cfr Feb 8 '15 at 2:51
  • 2
    Please clarify purpose/context of these command. Why is there a space before <Text>? What is the purpose of the final \Large? – Heiko Oberdiek Feb 8 '15 at 2:53
  • If you change the size in the middle of a paragraph, as this suggests, the line spacing etc. will be that which is active when the paragraph ends. This is likely to look odd unless we know more about how you are planning to use this! – cfr Feb 8 '15 at 2:54
  • Again, please post an MWE. However, you should not be formatting headings manually at all. You should be using markup e.g. \section{Heading}. – cfr Feb 8 '15 at 2:59
  • May be you only want use {\LARGE text } to restore the previous font size. If you want a syntax similar to \section{text} to make a heading, then some \newcommand\Heading[1]{{\LARGE #1}} or \newcommand\Heading[1]{\bigskip{\LARGE #1}\bigskip} could make a more or less formatted fake heading, but as cfr said, you should not use this kind of naïve manual markup for headings. – Fran Feb 8 '15 at 10:52
1

Here are some possibilities with a demonstration of their effects...

\documentclass{article}
\begin{document}
\newcommand\sizeswitch[1]{\LARGE{} #1\Large}
  Normal text. \sizeswitch{Bigger text.} Medium text.

  \normalsize

  Normal text.

  \sizeswitch{Bigger text.}

  Medium text.

  \normalsize

\renewcommand\sizeswitch[1]{\LARGE{} #1\par\Large}
  Normal text. \sizeswitch{Bigger text.} Medium text.

  \normalsize

  Normal text.

  \sizeswitch{Bigger text.}

  Medium text.
\end{document}

size switching

You should not use this kind of manual markup for headings, though. Rather, you should use LaTeX's markup e.g. \section, \subsection etc.

Here, I show how to make the section headings use \Large in the ordinary (rather than bold) weight, and how to create a convenience command for setting some text in the \large size at the start of the section (or anywhere).

\documentclass{article}
\usepackage{kantlipsum}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
  {\normalfont\Large}}
\makeatother
\newcommand\sectionstarter[1]{%
  \large #1\par\normalsize}
\begin{document}
  By default, sections are formatted in  both \verb|\Large| and bold font.
  In this document, however, they are merely \verb|\Large|.
  \section{A section}
  \kant[1]
  \section*{Unnumbered section}
  \sectionstarter{This is formatted in a medium size.}
  \kant[2]
\end{document}

section headings

Note that the point here is not (should not be) to save typing. Rather, it it to ensure consistency, readability and maintainability. If you later decide you want all \sectionstarter{} text in bold or sans or something, you just change the definition in the preamble.

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.