LyXHow to Align the Float Caption?

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

How to Align the Float Caption?

Post by insipidtoast »

The figure in the float can be aligned using the edit--->paragraph settings menu, but the float caption seems to always stay in the center. What do I do if I want it on the left of the page?
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class

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

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

How to Align the Float Caption?

Post by scottkosty »

insipidtoast wrote:The figure in the float can be aligned using the edit--->paragraph settings menu, but the float caption seems to always stay in the center. What do I do if I want it on the left of the page?
Check out the caption package. (just google "latex caption package" to find its documentation. You probably already have it installed).

Putting this in Document > Settings > LaTeX preamble works for me:

Code: Select all

\usepackage[singlelinecheck=false,justification=justified]{caption}
Does that work?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How to Align the Float Caption?

Post by localghost »

scottkosty wrote:Check out the caption package. (just google "latex caption package" to find its documentation. You probably already have it installed). […]
No need for a search engine. The caption package -- as every official package -- has an entry on CTAN where you can get its manual. In case the package is already installed, the texdoc command line tool is the way to go.

Code: Select all

texdoc caption
Another quite new source for package manuals is the TeXdoc Online website.


Thorsten
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

How to Align the Float Caption?

Post by Stefan Kottwitz »

By the way, no need to google a package documentation, even of it or its documentation is not locally installed: the already mentioned TeXdoc server has been installed to support this forum: there's a doc button, which you can see when editing a post - double lick a package name, and the button generates the documentation link you you. I think it's very handy to conveniently link the suitable package manual for the answerers and for the questioner to open it. Here, the doc button produces this link: caption. The small icon should give a visual hint.

Besides that, there's a CTAN button for generating the link to the package archive page, some further buttons lead to command reference or produce an MWE link, just as a support for the answerers to make writing easier.

Stefan
LaTeX.org admin
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

How to Align the Float Caption?

Post by insipidtoast »

"Please note that the caption package is only controlling the look & feel of the captions. It does
not control the placement of the captions."

-Taken from the first page of the link in the above post.
scottkosty wrote:
insipidtoast wrote:The figure in the float can be aligned using the edit--->paragraph settings menu, but the float caption seems to always stay in the center. What do I do if I want it on the left of the page?
Does that work?
You mean does the edit-->paragraphp settings menu then allow me to left justify the caption after I've copy and pasted your code into the Latex Preamble?
The answer is no.

*****Sorry scottkosty, entering that code actually did work, I just didn't notice any changes until previewing the pdf. Great quick fix! How'd you learn that? Makes no sense why lyx would have the default as a centered caption.*****

And Yes, that caption package is already installed.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

How to Align the Float Caption?

Post by scottkosty »

Thank you for the corrections, localghost, and Stefan_K.
insipidtoast wrote: *****Sorry scottkosty, entering that code actually did work, I just didn't notice any changes until previewing the pdf. Great quick fix! How'd you learn that? Makes no sense why lyx would have the default as a centered caption.*****

And Yes, that caption package is already installed.
It is not LyX's default; it is LaTeX's default. I learned it by googling "align caption latex package" or something like that, but if it didn't show up in the first few links I was going to check out the caption package (which I had prior exposure to). With time you will learn the difference between LyX and LaTeX and that will help you search.
Post Reply