Graphics, Figures & TablesFloating Graphic Types and ClassicThesis Layout

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

Floating Graphic Types and ClassicThesis Layout

Post by AndyBlue »

Dear honorable Lyx users,

I am a very recent user of Lyx 2.3.0 on OSX 10.13.3 (High Sierra) and am preparing a thesis in the field of organic chemistry with the ClassicThesis layout downloaded from https://bitbucket.org/amiede/classicthesis/wiki/Home. My thesis has four graphic types (Figures, Schemes, Tables, and Equations), and each graphic type will need to have a separate listing (List of Figures, List of Schemes,...) in the front of the thesis.

Based on my research, it seems that the only way to have different graphic types is by defining separate floats and that the best (only?) way to do this is using the caption https://ctan.org/pkg/caption and float https://ctan.org/pkg/float packages. I've downloaded these packages and installed them and their .sty files using the instructions provided in https://tex.stackexchange.com/questions ... le-in-lyx? in my Lyx user directory (~/Library/Application Support/LyX-2.3/layouts). I've also installed the packages in the same directory that my working documents are located. I've rerun the reconfiguration command (Tools ->Reconfigure) and I pasted into the preamble (Document -> Settings ->Latex Preamble) the following commands I found online: (https://latex.org/forum/viewtopic.php?t=26451

\usepackage{float}
\usepackage{newfloat}
\usepackage{caption}


\DeclareFloatingEnvironment[
fileext = los, % file extension for the list of schemes
listname = {List of schemes}, % heading for the list
name = Scheme, % name in captions
placement = htp % default floating paramaters
]{scheme}


It's my understanding that these commands should insert a new menu item called "Scheme" under Insert -> Float, and that new floating Schemes would behave similarly to floating Figures but I don't see Schemes anywhere in the menus. I'm sure that the answer is probably elementary but I've spent about ten hours trying to resolve this issue. It seems that the OSX version of Lyx differs subtly but sufficiently from Windows and Unix versions of Lyx.

The document I'm working with is a subdocument of a master document. Should I be adding floating schemes to the master document instead of a subdocument? Would floating graphic types automatically appear in subdocuments if they are defined in a master document?

I'd appreciate any guidance that the honorable community can provide. Thank you in advance.

Sincerely,
AndyBlue

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Floating Graphic Types and ClassicThesis Layout

Post by AndyBlue »

Dear all,

I'm the original poster and still haven't been able to get Lyx to add a new float type called "Schemes" in my master document. I'm attaching a sample document containing the most recent header code I was able to glean from http://www.andy-roberts.net/writing/lat ... s_captions. The code is reproduced below:

\floatstyle{plain}
\usepackage{float}
\newfloat{Scheme}{tbp}{sch}[chapter]
\begin{document}
\begin{Scheme}
\begin{verbatim}
added

I've spent several evenings on this issue without making any progress. Would anyone have any advice? Maybe the "Float" command is incompatible with Lyx for Mac?

I also get several Lyx errors when (pre)viewing the code above in PDF format using Preview.app but I can't see any obvious errors in the code.

Thanks for any advice,
AndyBlue
Attachments
testfile for floats.lyx
(2.25 KiB) Downloaded 229 times
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Floating Graphic Types and ClassicThesis Layout

Post by Johannes_B »

https://tex.stackexchange.com/questions ... cate-float

That should work for classicthesis, if classicthesis still uses a KOMA-class. And if classicthesis doesn't destroy basic functionality, like it often does.

Honestly, though there are many fans, i cannot recommend classicthesis or any other template. Using a [/url=https://en.wikibooks.org/wiki/LaTeX/Scientific_Reports]minimal template[/url] is often the better idea.
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

Floating Graphic Types and ClassicThesis Layout

Post by AndyBlue »

Hello Johannes_B, thank you for the link and suggestions. I tried the technique discussed in the webpage you cited and got the code to work (sort of). However, I was expecting Lyx to add a new menu entry under "Insert-> Float -> Scheme" so that I could add a graphics image, and this does not seem possible using the technique in the webpage. At this point, I have far too much time invested in ClassicThesis for chemistry subject matter to switch to another template.

I did some more searching and found two webpages at https://tex.stackexchange.com/questions ... o-listing? and at http://lyx.475766.n2.nabble.com/Figures ... 75802.html which showed how to add a new floating graphic box type, and this solution was exactly what I was looking for. The code I added was as follows:

Code: Select all

Float
    Type                  scheme
    Name                  scheme
    GuiName               Scheme Listing
    Placement             tbp
    Extension             los
    NumberWithin          none
    Style                 plain
    ListName              "List of Schemes"
    IsPredefined false
    UsesFloatPkg true
End
Using the code above, I can get Lyx to add a Scheme float type which seems to function exactly as a figure float :D .
My next tasks are to figure out how to update the captions so that the schemes are numbered as "Scheme 1.1", and how to get the List of Schemes in the TOC to identify the schemes as "Schemes" and not as "Figures". Hopefully this won't be too difficult to troubleshoot.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Floating Graphic Types and ClassicThesis Layout

Post by Johannes_B »

I am not a big fan of LyX, as it hides stuff. What i linked earlier is so easy to do with LaTeX, but i personally wouldn't know how to add a menu button in LyX. LaTeX was designed not to have any menu buttons, and i never missed any.

I am not sure why people use LyX. I has to be more time consuming.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply