TransWikia.com

Using acronyms in TOC

TeX - LaTeX Asked on December 17, 2021

I am writing a thesis and need to use acronyms in sections. After compiling, the sections are ok, but the TOC are not. Following the MWE below, section 1.3 prints 1.3 About NASA in page 4. However, in the TOC, it shows 1.3 About National Aeronautics and Space Administration (NASA), when it should be just 1.3 About NASA (identically to printed in page 4). The same problem happens to sections up to 1.7.

So, my question is: is there a way to make TOC print sections exactly equal to their title in the text? Thank you!

This is a MWE:

documentclass[12pt, openright, twoside, a4paper, chapter=TITLE, english]{memoir}

usepackage{acronym}

usepackage{hyperref}
    hypersetup{
        colorlinks  = true,
        linkcolor   = blue,
        filecolor   = blue,
        citecolor   = blue,      
        urlcolor    = blue,
        }

usepackage{fancyhdr}
    pagestyle{empty}
    pagestyle{fancy}
    fancyhf{} %... clears all headers and footers
    fancyhead[LE, RO]{thepage} %... left-even right-odd page numbering
    fancyhead[LO]{rightmark} %... left-odd page section title
    fancyhead[RE]{leftmark} %... right-even page subsection title
    renewcommand{headrulewidth}{0.4pt}

title{An example of use of acronyms}
author{J. B.}

begin{document}
maketitle

tableofcontents*

chapter{A little bit on space agencies}




section{Meaning of the acronyms used in this example}
begin{acronym}[Roscosmos]
    acro{CSA}{Canadian Space Agency}
    acro{ESA}{European Space Agency}
    acro{ISS}{International Space Station}
    acro{JAXA}{Japan Aerospace Exploration Agency}
    acro{NACA}{National Advisory Committee for Aeronautics}
    acro{NASA}{National Aeronautics and Space Administration}
    acro{Roscosmos}{Roscosmos State Corporation for Space Activities}
end{acronym}




section{Introduction}
The ac{ISS} program is a multi-national collaborative project between five participating space agencies: ac{NASA}, from United States, ac{Roscosmos}, from Russia, ac{JAXA}, from Japan, ac{ESA}, from Europe, and ac{CSA}, from Canada. The ownership and use of the space station is established by intergovernmental treaties and agreements. It evolved from the Space Station Freedom proposal.
{tinybfseries [Source: Wikipedia]}




section{About ac{NASA}}
ac{NASA} was established in 1958, succeeding the ac{NACA}. The new agency was to have a distinctly civilian orientation, encouraging peaceful applications in space science. Since its establishment, most US space exploration efforts have been led by ac{NASA}, including the Apollo Moon landing missions, the Skylab space station, and later the Space Shuttle. ac{NASA} is supporting the ac{ISS} and is overseeing the development of the Orion spacecraft, the Space Launch System, and Commercial Crew vehicles. The agency is also responsible for the Launch Services Program, which provides oversight of launch operations and countdown management for uncrewed ac{NASA} launches.
{tinybfseries [Source: Wikipedia]}




section{About ac{ESA}}
ac{ESA}'s space flight programme includes human spaceflight (mainly through participation in the International Space Station programme); the launch and operation of uncrewed exploration missions to other planets and the Moon; Earth observation, science and telecommunication; designing launch vehicles; and maintaining a major spaceport, the Guiana Space Centre at Kourou, French Guiana. The main European launch vehicle Ariane 5 is operated through Arianespace with ac{ESA} sharing in the costs of launching and further developing this launch vehicle. The agency is also working with ac{NASA} to manufacture the Orion Spacecraft service module that will fly on the Space Launch System.
{tinybfseries [Source: Wikipedia]}




section{About ac{JAXA}}
The ac{JAXA} is the Japanese national aerospace and space agency. Through the merger of three previously independent organizations, ac{JAXA} was formed on 1 October 2003. ac{JAXA} is responsible for research, technology development and launch of satellites into orbit, and is involved in many more advanced missions such as asteroid exploration and possible human exploration of the Moon. Its motto is One ac{JAXA} and its corporate slogan is Explore to Realize (formerly Reaching for the skies, exploring space).
{tinybfseries [Source: Wikipedia]}




section{About ac{CSA}}
The ac{CSA} is the national space agency of Canada, established in 1990 by the Canadian Space Agency Act. The agency reports to the federal Minister of Innovation, Science, and Economic Development.
{tinybfseries [Source: Wikipedia]}

The current president is Sylvain Laporte, who took the position March 9, 2015. The ac{CSA}'s headquarters are located at the John H. Chapman Space Centre in Longueuil, Quebec. The agency also has offices in Ottawa, Ontario, at the David Florida Laboratory, and small liaison offices in Houston; Washington, D.C.; and Paris.
{tinybfseries [Source: Wikipedia]}




section{About ac{Roscosmos}}
The ac{Roscosmos}, is a state corporation responsible for the wide range and types of space flights and cosmonautics programs for the Russian Federation.
{tinybfseries [Source: Wikipedia]}

Originally part of the Federal Space Agency, the corporation evolved and consolidated itself into a national state corporation on 28 December 2015 through a presidential decree. Before 1992, Roscosmos was a part of the Russian Aviation and Space Agency.
{tinybfseries [Source: Wikipedia]}

end{document}

2 Answers

As explained in the other answer, the TOC has the first occurrence of your acronyms, so they get spelled out there (in fact, the acronym manual warns about this). Generally speaking, if you want something different to appear in the TOC, then you can provide the different as an optional argument to the sectioning command. In this case, that would be section[About NASA]{About ac{NASA}}. But we can do better.

The acronym package provides several commands beyond simply ac. The most relevant is acs, which means that you want the short form of the acronym (also, using a capital A will try to capitalize any expansion for the beginning of a sentence). I would also consider marking the acronym as unused at that point or at least used acl immediately in the section (I would be really annoyed to see a section titled "About NASA" that never tells me what NASA means). The former requires a small tweaking of the acronym internals.

You may also want to consider having the in your full acronym expansions. The point of the acronym package is that you don't know if ac{NACA} will expand or not, so saying the ac{NACA} could end up being the NACA. Instead, I would have:

section{About acs{NASA}}acnotused{NASA}
Ac{NASA} was established in 1958, succeeding ac{NACA}.

Putting this together, I would have something like the following:

documentclass[openany]{memoir}

usepackage{acronym}

makeatletter
newcommand*{acnotused}[1]{AC@reset{#1}}
makeatother

begin{document}

tableofcontents*

chapter{A little bit on space agencies}

section{Meaning of the acronyms used in this example}
begin{acronym}[Roscosmos]
    acro{CSA}{Canadian Space Agency}
    acro{ESA}{European Space Agency}
    acro{ISS}{International Space Station}
    acro{JAXA}{the Japan Aerospace Exploration Agency}
    acro{NACA}{the National Advisory Committee for Aeronautics}
    acro{NASA}{the National Aeronautics and Space Administration}
    acro{Roscosmos}{Roscosmos State Corporation for Space Activities}
end{acronym}

section{Introduction}
The ac{ISS} program is a multi-national collaborative project between five participating space agencies: ac{NASA}, from United States, ac{Roscosmos}, from Russia, ac{JAXA}, from Japan, the ac{ESA}, from Europe, and the ac{CSA}, from Canada. The ownership and use of the space station is established by intergovernmental treaties and agreements. It evolved from the Space Station Freedom proposal.
{tinybfseries [Source: Wikipedia]}

section{About acs{NASA}}acnotused{NASA}
Ac{NASA} was established in 1958, succeeding ac{NACA}. The new agency was to have a distinctly civilian orientation, encouraging peaceful applications in space science. Since its establishment, most US space exploration efforts have been led by ac{NASA}, including the Apollo Moon landing missions, the Skylab space station, and later the Space Shuttle. Ac{NASA} is supporting the ac{ISS} and is overseeing the development of the Orion spacecraft, the Space Launch System, and Commercial Crew vehicles. The agency is also responsible for the Launch Services Program, which provides oversight of launch operations and countdown management for uncrewed ac{NASA} launches.
{tinybfseries [Source: Wikipedia]}

section{About acs{ESA}}acnotused{ESA}
The acl{ESA}'s space flight programme includes human spaceflight (mainly through participation in the International Space Station programme); the launch and operation of uncrewed exploration missions to other planets and the Moon; Earth observation, science and telecommunication; designing launch vehicles; and maintaining a major spaceport, the Guiana Space Centre at Kourou, French Guiana. The main European launch vehicle Ariane 5 is operated through Arianespace with the ac{ESA} sharing in the costs of launching and further developing this launch vehicle. The agency is also working with ac{NASA} to manufacture the Orion Spacecraft service module that will fly on the Space Launch System.
{tinybfseries [Source: Wikipedia]}

section{About acs{JAXA}}acnotused{JAXA}
Ac{JAXA} is the Japanese national aerospace and space agency. Through the merger of three previously independent organizations, ac{JAXA} was formed on 1 October 2003. Ac{JAXA} is responsible for research, technology development and launch of satellites into orbit, and is involved in many more advanced missions such as asteroid exploration and possible human exploration of the Moon. Its motto is One ac{JAXA} and its corporate slogan is Explore to Realize (formerly Reaching for the skies, exploring space).
{tinybfseries [Source: Wikipedia]}

section{About acs{CSA}}acnotused{CSA}
The ac{CSA} is the national space agency of Canada, established in 1990 by the Canadian Space Agency Act. The agency reports to the federal Minister of Innovation, Science, and Economic Development.
{tinybfseries [Source: Wikipedia]}

The current president is Sylvain Laporte, who took the position March 9, 2015. The ac{CSA}'s headquarters are located at the John H. Chapman Space Centre in Longueuil, Quebec. The agency also has offices in Ottawa, Ontario, at the David Florida Laboratory, and small liaison offices in Houston; Washington, D.C.; and Paris.
{tinybfseries [Source: Wikipedia]}

section{About acs{Roscosmos}}acnotused{Roscosmos}
Ac{Roscosmos} is a state corporation responsible for the wide range and types of space flights and cosmonautics programs for the Russian Federation.
{tinybfseries [Source: Wikipedia]}

Originally part of the Federal Space Agency, the corporation evolved and consolidated itself into a national state corporation on 28 December 2015 through a presidential decree. Before 1992, ac{Roscosmos} was a part of the Russian Aviation and Space Agency.
{tinybfseries [Source: Wikipedia]}

end{document}

Answered by Teepeemm on December 17, 2021

The expansion in the TOC is due to the fact that it is the first occurrence in the text.

You can try this in the section title:

section[About texorpdfstring{NASA}{NASA}]{About ac{NASA}}

(The expansion due to the first occurrence is now done in the paragraph in the Introduction.)

For more details, you can read the package instructions in: https://github.com/oetiker/acronym/blob/master/acronym.dtx

For the usage of texorpdfstring, please see, for instance, the following answer: How to use `texorpdfstring`. Characters disappear

Answered by fdireito on December 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP