LaTeX forum ⇒ Graphics, Figures & TablesCustom Floats in TOC incorrectly labeled as "Figure"

Information and discussion about graphics, figures & tables in LaTeX documents.
AndyBlue
Posts: 6
Joined: Thu Mar 29, 2018 4:11 am

Custom Floats in TOC incorrectly labeled as "Figure"

Postby AndyBlue » Tue May 15, 2018 7:15 am

Dear Honorable Community,

I am formatting my chemistry thesis in Lyx using the ClassicThesis template (which is based on the scrreprt class from KOMA Script). I added a new Schemes float type (see below) to easily provide a way of inserting graphical chemical reaction schemes (via Insert -> Float -> Scheme) However, the captions in the "List of Schemes" in the TOC are all labeled as Figures and not Schemes as shown in the screen shot below,
List of Schemes.png
List of Schemes.png (65.6 KiB) Viewed 889 times
and I can't determine how to update Lyx to correct this situation.

Here is my MWE:
[MWE]
In the local layout:
Format 35
Float
Type scheme
Name scheme
GuiName Scheme Listing
Placement tbp
Extension los
NumberWithin none
Style plain
ListName "List of Schemes"
IsPredefined false
UsesFloatPkg true
floatperchapter true
Entryprefix Scheme
RefPrefix sch
End

In the preamble:
% \usepackage{float}
%\newlistof{listofschemes}{los}{List of Schemes}
\counterwithin{scheme}{section}
\numberwithin{scheme}{chapter}
\usepackage{scrhack}

In the TOC Contents child document:
%*************************
% List of Schemes
%*************************
%\phantomsection
%\addcontentsline{toc}{chapter}{\listschemename}
\listof{scheme}{List of Schemes}
\pdfbookmark[1]\newlistof{listofschemes} %{\listschemename}{los}
[/MWE]

Inserting the "List of Schemes" via the menu option (Insert -> List/TOC -> List of Schemes) will give an empty section. Uncommenting "{\listschemename}{los}" will give me an error message that \listschemename is not defined.

I've tried to follow suggestions in https://tex.stackexchange.com/questions/81776/formatting-list-of-custom-floats-in-classic-thesis and a few other pages but have not been successful in determining the error. Could anybody kindly point me in the correct direction?

Thank you,
Andrew

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3854
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue May 15, 2018 7:30 am

Without a minimal working example, it is really hard to help.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

AndyBlue
Posts: 6
Joined: Thu Mar 29, 2018 4:11 am

Postby AndyBlue » Wed May 16, 2018 5:25 am

Thanks for the quick reply, Johannes.
Below is a minimal LaTeX example which I extracted from my master document and which shows "Schemes" mislabeled as "Figures".

  1. %% LyX 2.3.0 created this file. For more info, see <!-- m --><a class="postlink" href="http://www.lyx.org/">http://www.lyx.org/</a><!-- m -->.
  2. %% Do not edit unless you really know what you are doing.
  3. \documentclass[twoside,fleqn,american,fontsize=11pt,paper=a4,BCOR=5mm,twoside,openright,cleardoublepage=empty,titlepage,numbers=noenddot,headinclude=true,footinclude=true]{scrreprt}
  4. \usepackage[T1]{fontenc}
  5. \usepackage[utf8]{inputenc}
  6. \setcounter{tocdepth}{3}
  7. \PassOptionsToPackage{hyperfootnotes=false,pdfpagelabels}{hyperref}
  8. \usepackage{babel}
  9. \usepackage{float}
  10. \usepackage[unicode=true,pdfusetitle,
  11. bookmarks=true,bookmarksnumbered=true,bookmarksopen=true,bookmarksopenlevel=4,
  12. breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
  13. {hyperref}
  14. \usepackage{breakurl}
  15.  
  16. \makeatletter
  17.  
  18. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
  19. \floatstyle{plain}
  20. \newfloat{scheme}{tbp}{los}
  21. \providecommand{\schemename}{Scheme}
  22. \floatname{scheme}{\protect\schemename}
  23.  
  24. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
  25. % Classic Thesis Style loader
  26. \makeatother
  27. \input{classicthesis-config-LyX.tex}
  28. \makeatletter
  29.  
  30. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
  31. \counterwithout{footnote}{chapter}
  32. \newlistof{listofschemes}{List of Schemes}
  33. \counterwithin{scheme}{section}
  34. \usepackage{layout}
  35. \numberwithin{scheme}{chapter}
  36. \usepackage{scrhack}
  37. \makeatother
  38.  
  39. \usepackage[style=authoryear,backref=true,isbn=false,sorting=nyt,maxbibnames=9]{biblatex}
  40. \begin{document}
  41. \frenchspacing
  42. \raggedbottom
  43. \pagenumbering{roman}
  44. \pagestyle{plain}
  45.  
  46. %*************************
  47. % Table of Contents
  48. %*************************
  49. \phantomsection
  50. \pdfbookmark[0]{\contentsname}{tableofcontents}
  51. \setcounter{tocdepth}{2} % <-- 2 includes up to subsections in the ToC
  52. \setcounter{secnumdepth}{3} % <-- 3 section numbers up to subsubsections
  53. \manualmark
  54. \markboth{\spacedlowsmallcaps{\contentsname}}{\spacedlowsmallcaps{\contentsname}}
  55. \tableofcontents
  56. \automark[section]{chapter}
  57. \renewcommand{\chaptermark}[1]{\markboth{\spacedlowsmallcaps{#1}}{\spacedlowsmallcaps{#1}}}
  58. \renewcommand{\sectionmark}[1]{\markright{\thesection\enspace\spacedlowsmallcaps{#1}}}
  59.  
  60. %*************************
  61. % List of Schemes
  62. %*************************
  63. %\phantomsection
  64. %\addcontentsline{toc}{chapter}{\listschemename}
  65. \listof{scheme}{List of Schemes}
  66. \pdfbookmark[1]\newlistof{listofschemes}{\listschemename}{los}
  67. \pagestyle{scrheadings}
  68. Lorem ipsum dolor sit amet.
  69. \begin{scheme}
  70. Consectetur adipiscing elit.
  71. \caption{Retrosynthetic Analysis}
  72. \end{scheme}
  73. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  74. \begin{scheme}
  75. Ut enim ad minim veniam.
  76. \caption{Synthesis of Compound A}
  77. \end{scheme}
  78. \end{document}


In case it is helpful, I'm also pasting the code from the ClassicThesis configuration file (classicthesis-config-LyX.tex) which is referenced in the preamble:

  1. % ****************************************************************************************************
  2. % classicthesis-config-LyX.tex
  3. % Use it in the preamble of your ClassicThesis.lyx
  4. % ****************************************************************************************************
  5.  
  6. % ****************************************************************************************************
  7. % 1. Configure classicthesis for your needs here. At some point you will probably want to set
  8. % "drafting" to false in order to deactivate the time-stamp on the bottom of the pages
  9. % See ClassicThesis.pdf for more information.
  10. % ****************************************************************************************************
  11. \PassOptionsToPackage{
  12. drafting=false, % print version information on the bottom of the pages
  13. tocaligned=false, % the left column of the toc will be aligned (no indentation)
  14. dottedtoc=false, % page numbers in ToC flushed right
  15. parts=true, % use part division
  16. eulerchapternumbers=true, % use AMS Euler for chapter font (otherwise Palatino)
  17. linedheaders=false, % chaper headers will have line above and beneath
  18. floatperchapter=true, % numbering per chapter for all floats (i.e., Figure 1.1)
  19. eulermath=false, % use awesome Euler fonts for mathematical formulae (only with pdfLaTeX)
  20. beramono=true, % toggle a nice monospaced font (w/ bold)
  21. palatino=true % toggle the standard roman font, see end of this file for more suggestions
  22. }{classicthesis}
  23.  
  24.  
  25. % ****************************************************************************************************
  26. % 2. Personal data and user ad-hoc commands
  27. % ****************************************************************************************************
  28. \newcommand{\myTitle}{A\xspace}
  29. \newcommand{\mySubtitle}{A Thesis Submitted in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy\xspace}
  30. \newcommand{\myDegree}{Doctor of Philosophy- Organic Chemistry\xspace}
  31. \newcommand{\myName}{B\xspace}
  32. \newcommand{\myProf}{C\xspace}
  33. \newcommand{\myOtherProf}{D\xspace}
  34. \newcommand{\mySupervisor}{Put name here\xspace}
  35. \newcommand{\myFaculty}{F\xspace}
  36. \newcommand{\myDepartment}{Put data here\xspace}
  37. \newcommand{\myUni}{G\xspace}
  38. \newcommand{\myLocation}{H\xspace}
  39. \newcommand{\myTime}{I\xspace}
  40. \newcommand{\myVersion}{First Edition}
  41. % ****************************************************************************************************
  42.  
  43. % ****************************************************************************************************
  44. % 3. Loading some handy packages
  45. % ****************************************************************************************************
  46. \usepackage{csquotes} % biblatex depends on these
  47. \usepackage{textgreek}
  48.  
  49. \usepackage{scrhack} % fix warnings when using KOMA with listings package
  50. \usepackage{xspace} % to get the spacing after macros right
  51. \usepackage{mparhack} % get marginpar right
  52. \PassOptionsToPackage{printonlyused,smaller}{acronym}
  53. \usepackage{acronym} % nice macros for handling all acronyms in the thesis
  54. %\renewcommand{\bflabel}[1]{{#1}\hfill} % fix the list of acronyms --> no longer working
  55. %\renewcommand*{\acsfont}[1]{\textsc{#1}}
  56. %\renewcommand*{\aclabelfont}[1]{\acsfont{#1}}
  57. \def\bflabel#1{{\acsfont{#1}\hfill}}
  58. \def\aclabelfont#1{\acsfont{#1}}
  59. % ****************************************************************************************************
  60.  
  61. % ****************************************************************************************************
  62. % 4. Setup floats: tables, (sub)figures, and captions
  63. % ****************************************************************************************************
  64. \usepackage{tabularx} % better tables
  65. \setlength{\extrarowheight}{3pt} % increase table row height
  66. \newcommand{\tableheadline}[1]{\multicolumn{1}{l}{\spacedlowsmallcaps{#1}}}
  67. \usepackage{caption}
  68. % Thanks to cgnieder and Claus Lahiri
  69. % <!-- m --><a class="postlink" href="http://tex.stackexchange.com/questions/69349/spacedlowsmallcaps-in-caption-label">http://tex.stackexchange.com/questions/ ... tion-label</a><!-- m -->
  70. % [REMOVED DUE TO OTHER PROBLEMS, SEE ISSUE #82]
  71. %\DeclareCaptionLabelFormat{smallcaps}{\bothIfFirst{#1}{~}\MakeTextLowercase{\textsc{#2}}}
  72. %\captionsetup{font=small,labelformat=smallcaps} % format=hang,
  73. \captionsetup{font=small} % format=hang,
  74. \usepackage{subfig}
  75. % ****************************************************************************************************
  76.  
  77. % ****************************************************************************************************
  78. % 5. Setup code listings
  79. % ****************************************************************************************************
  80. \usepackage{listings}
  81. %\lstset{emph={trueIndex,root},emphstyle=\color{BlueViolet}}%\underbar} % for special keywords
  82. \lstset{language=[LaTeX]Tex,%C++,
  83. keywordstyle=\color{RoyalBlue},%\bfseries,
  84. basicstyle=\small\ttfamily,
  85. %identifierstyle=\color{NavyBlue},
  86. commentstyle=\color{Green}\ttfamily,
  87. stringstyle=\rmfamily,
  88. numbers=none,%left,%
  89. numberstyle=\scriptsize,%\tiny
  90. stepnumber=5,
  91. numbersep=8pt,
  92. showstringspaces=false,
  93. breaklines=true,
  94. frameround=ftff,
  95. frame=single,
  96. belowcaptionskip=.75\baselineskip
  97. %frame=L
  98. }
  99.  
  100.  
  101. % ****************************************************************************************************
  102.  
  103.  
  104. % ****************************************************************************************************
  105. % 6. Setup hyperreferences; enable citation backreferences (note: biblatex has its own way)
  106. % ****************************************************************************************************
  107. \PassOptionsToPackage{hyperfootnotes=false,pdfpagelabels}{hyperref} % backref linktocpage pagebackref
  108. \usepackage{hyperref}
  109.  
  110. \hypersetup{%
  111. %draft, % hyperref's draft mode, for printing see below
  112. colorlinks=true, linktocpage=true, pdfstartpage=3, pdfstartview=FitV,%
  113. % uncomment the following line if you want to have black links (e.g., for printing)
  114. %colorlinks=false, linktocpage=false, pdfstartpage=3, pdfstartview=FitV, pdfborder={0 0 0},%
  115. breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
  116. plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
  117. hypertexnames=true, pdfhighlight=/O,%nesting=true,%frenchlinks,%
  118. urlcolor=webbrown, linkcolor=RoyalBlue, citecolor=webgreen, %pagecolor=RoyalBlue,%
  119. %urlcolor=Black, linkcolor=Black, citecolor=Black, %pagecolor=Black,%
  120. pdftitle={\myTitle},%
  121. pdfauthor={\textcopyright\ \myName, \myUni, \myFaculty},%
  122. pdfsubject={},%
  123. pdfkeywords={},%
  124. pdfcreator={},%
  125. pdfproducer={LaTeX with classicthesis style}%
  126. }
  127.  
  128. % ********************************************************************
  129. % Setup autoreferences
  130. % ********************************************************************
  131. % There are some issues regarding autorefnames
  132. % <!-- m --><a class="postlink" href="http://www.ureader.de/msg/136221647.aspx">http://www.ureader.de/msg/136221647.aspx</a><!-- m -->
  133. % <!-- m --><a class="postlink" href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords">http://www.tex.ac.uk/cgi-bin/texfaq2htm ... latexwords</a><!-- m -->
  134. % you have to redefine the makros for the
  135. % language you use, e.g., american, ngerman
  136. % (as chosen when loading babel/AtBeginDocument)
  137. % ********************************************************************
  138. \makeatletter
  139. \@ifpackageloaded{babel}%
  140. {%
  141. \addto\extrasamerican{%
  142. \renewcommand*{\figureautorefname}{Figure}%
  143. \renewcommand*{\tableautorefname}{Table}%
  144. \renewcommand*{\partautorefname}{Part}%
  145. \renewcommand*{\chapterautorefname}{Chapter}%
  146. \renewcommand*{\sectionautorefname}{Section}%
  147. \renewcommand*{\subsectionautorefname}{Section}%
  148. \renewcommand*{\subsubsectionautorefname}{Section}%
  149. }%
  150. \addto\extrasngerman{%
  151. \renewcommand*{\paragraphautorefname}{Absatz}%
  152. \renewcommand*{\subparagraphautorefname}{Unterabsatz}%
  153. \renewcommand*{\footnoteautorefname}{Fu\"snote}%
  154. \renewcommand*{\FancyVerbLineautorefname}{Zeile}%
  155. \renewcommand*{\theoremautorefname}{Theorem}%
  156. \renewcommand*{\appendixautorefname}{Anhang}%
  157. \renewcommand*{\equationautorefname}{Gleichung}%
  158. \renewcommand*{\itemautorefname}{Punkt}%
  159. }%
  160. % Fix to getting autorefs for subfigures right (thanks to Belinda Vogt for changing the definition)
  161. \providecommand{\subfigureautorefname}{\figureautorefname}%
  162. }{\relax}
  163. \makeatother
  164.  
  165.  
  166. % ********************************************************************
  167. % 7. Last, but not least...
  168. % ********************************************************************
  169. \usepackage{classicthesis}
  170. \sloppypar
  171.  
  172. \usepackage[paperwidth=8in,
  173. paperheight=10in,
  174. voffset = -.20in,
  175. bottom = 1in ]{geometry}
  176.  
  177. % ****************************************************************************************************


Thanks for any guidance you can provide.

Sincerely,
Andrew

User avatar
Johannes_B
Site Moderator
Posts: 3854
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed May 16, 2018 6:20 am

Add \renewcommand{\cftfigpresnum}{Wombat~} right before the list of schemes.

There is a whole bunch of strange code in your example. I am not sure which package should pick up what. The really strangest thing you are using is classicthesis.

Off-topic: I get some errors with your code, this might be due to me still using TeX Live 2017. The undefined commands, at least in part, are in the new LaTeX kernel and don't need a package. But with the code, i don't think you removed the package conciously.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

AndyBlue
Posts: 6
Joined: Thu Mar 29, 2018 4:11 am

Postby AndyBlue » Wed May 16, 2018 7:06 am

It works! It works! It works! It works! Thank you so much, Johannes! I don't think I would ever have figured out your solution. In any case, I quickly replaced "Wombat" with "Scheme" once I realized that Wombat was not an actual LaTeX command (haha).

My document was still getting an error when I generated the master document but I figured out that commenting out the following code, "% \pdfbookmark[1] \newlistof{listofschemes}{\listschemename}{los}" with the percent sign got rid of the error without affecting the List of Schemes.

My document now generates without any errors and it looks very good considering it is still a work in progress. I assume that any strange code is from the classicthesis template although I did enter some customizations to get particular features to look the way I want them to.

Thank you again,
Andrew


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 9 guests