\ Newcommand {\ section} {\ @ startsection {section} {1} {\ z @}%
{1.5 \ C vs \ @ plus.5 \ Cdp \ @ minus.2 \ Cdp}%
{.5 \ C vs \ @ plus.3 \ Cdp}%
{\ fontsize {19pt} \ selectfont \ bf}}

I want to change the font size of a section of tex, but it doesn't work very well.Reference siteIt didn't work when I saw it. Can you tell me who knows how to work?
The error is {\ fontsize {19pt} \ selectfont \ bf}} on this line.

  • Answer # 1

    LaTeX error message --Command ... already defined.

    \ Newcommand {\ section}

    ¥ sectionIs already defined, so why not change it to another name?

  • Answer # 2

    If you have any supplements such as document class and LaTeX processing system, please. The cause may be narrowed down due to these factors. Also, since the error message basically does not contain sensitive information, it would be helpful if you could add it.

    Below is the document classjlreqThe LaTeX processing system will be explained as upLaTeX.

    The structure of the file is as follows:

    $exa -T
    ├── Includes redefinition of change-section-style.tex # `\ section`.
    ├── index.aux # generated
    ├── index.dvi # generated
    ├── index.log # generated
    ├── index.pdf # generated
    ├── index.synctex.gz # generated
    └── index.tex # This is the main LaTeX file.
    Try to assemble without change

    Below is the main LaTeX fileindex.texwill do.

    % #! Uplatex
    \ documentclass {jlreq}
    % \ input {change-section-style}\ begin {document}
    \ section {Ah}
    \ end {document}

    At this time\ inputThe line is commented out. later\ sectionChange the behavior ofchange-section-style.texLet's write to enable this line and compare the typesetting results.

    If you compile in this state, it will look like the following.
    How to compile$llmk index.texis.

    Change and try to assemble

    Well, next\ sectionChange the style of.
    There are several ways to achieve this.
    In the content of the question\ sectionIt is solved by redefining.
    Documents often provide easier ways to change styles with document classes and packages. For example, I'm using this timejlreqabout$texdoc -l jlreqYou can select the document to browse by. Please use it by all means.

    By the way, if you refer to the contents in the link of the question text, a little later\ renewcommandYou can see that the example is shown.
    In LaTeX, once defined control spelling is re-defined\ newcommandIf you try to change it with, an error will occur.
    Quoted in the link\ newcommandThe code block containing\ sectionA quote from the original definition of.
    Don't try to use this as it is.

    A little later\ renewcommandAn example of redefinition by is shown.
    If you modify it with reference to this, will it be as follows?


    \ makeatletter
    \ renewcommand {\ section} {%
      \ @startsection {section} {1} {\ z @}%
      {1.5 \ Cvs \@plus.5 \ Cdp \@minus.2 \ Cdp}%
      {.5 \ Cvs \@plus.3 \ Cdp}%
      {\ fontsize {19pt} {0pt} \ selectfont \ textbf}}
    \ makeatother

    Now,index.texLet's check the result by removing the commented out part in.
    The compilation procedure is the same as before.

    You can see that the size of the characters has changed.

    Note: Other minor changes

    \ bfIs a TeX command rather than a LaTeX command, so there is a high possibility of an error in the new LaTeX environment.
    here\ textbfIs an alternative.

    \ fontsizeTakes two arguments. The size of the font itself and the line spacing are in order.
    Here, the line spacing value is set appropriately, but it needs to be adjusted.