Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fullwidth caption #145

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

HenningTimm
Copy link

@HenningTimm HenningTimm commented May 22, 2019

This PR adds the figurefw and tablefw environments which have a full width caption for use with full page and other large floats (as mentioned in #134). Both behave exactly like the figure* and table* environments, but also span the caption across the full width of the page.

I added an example to the sample-book file, which recycles the sine wave figure. I am not sure, if an example is necessary and if the table example could be enough. Personally, I required this mostly for full-page figures that also needed long explanatory texts, so I added that to the document.

I only tested this with the sample book yet, so I would appreciate anyone testing that this doen't break in larger projects.

@HenningTimm
Copy link
Author

A small issue I already identified is that the bounding box of the caption is not computed correctly yet. When placed in text, the caption is written into the following text. Additionally, when working with subfloat, subcaptions beneath the subfloats are also written over.

@HenningTimm
Copy link
Author

@Tafnab identified a potential problem with subtables and their captions, that I unfortunately have no time to investigate at the moment. For details, please refer to Issue #134.

@BeastyBlacksmith
Copy link

Do the references get correctly labeled with cref?

@HenningTimm
Copy link
Author

I don't know from the top of my head. I never (knowingly) used cref before. However, if I remember correctly, I only adapted sizes and margins. If labels work correctly with "normal" image environments, I'd wager they still do with the fullwidth ones.

@jklymak
Copy link

jklymak commented Jun 12, 2020

I don't know enough tex to vouch for the quality of this PR, but something like this would be very helpful to me...

visika added a commit to visika/tufte-latex that referenced this pull request Jun 14, 2021
@DNF2
Copy link

DNF2 commented Oct 19, 2021

I very much need this functionality.

But looking at the list of PRs going back several years, with apparently no activity, is it fair to say that this repository has been abandoned?

@HenningTimm
Copy link
Author

HenningTimm commented Oct 19, 2021

I have not seen any activity here in the last years. I wouldn't hold my breath.

If you want to take the (a little rocky) road and use this feature without it being merged into the main branch: This works and you only need to download two files. The majority of the files in this repo are for the example projects to compile but are not needed for the actual document classes. To work with this locally you will need to do following:

  1. Find a patched version of the file tufte-common.def. You can use the one from this branch or from my fork, but probably the most up-to-date version is the one from @visika's fork (who applied two additional PRs as well). Place this file in your working directory next to your latex file.
  2. Download the specific class you would like to use (tufte-book.cls or tufte-book.cls) from the either from the same source (or use the "normal" one) and place it in the same folder.
  3. Use the respective document class in your preamble, e.g. for tufte-book:
    \documentclass[a4paper,nobib]{tufte-book}
  4. You should now be able to use the figurefw environment:
    \begin{figurefw}[p]
        \centering
        % your image content here
        \includegraphics[width=.75\textwidth]{figures/your_figure_path}
    
        \caption{Caption text}
        \label{fig:my_fullwidth_figure}
    \end{figurefw}

I am reasonably sure this will work, but to make sure I will test this later this week. I verified that this works.

@Tafnab
Copy link

Tafnab commented Oct 19, 2021

I very much need this functionality.

But looking at the list of PRs going back several years, with apparently no activity, is it fair to say that this repository has been abandoned?

I have a number of FW environments using a modified tufte style. Can you be more specific about what you want, maybe some pseudo-code?

@DNF2
Copy link

DNF2 commented Oct 20, 2021

Can you be more specific about what you want

I looking for full width versions of table and figure, with captions not positioned as sidenotes. Preferably, it should be possible to put the caption below or above the float.

Pseudocode:

\begin{table*}
    \centering
    \caption{Here's my caption text. \label{tab:example}}
    \begin{tabular}
    ....
    \end{tabular}
\end{table*}

This would make a full-width table with the caption positioned above the table, and with the caption using the full table width (if the text is long enough.)

@Tafnab
Copy link

Tafnab commented Oct 20, 2021

Here is some working code from a book I did. I substituted "etc" for the actual words.

I can't attach the style and cls files because their "type" isn't supported by this "forum". A major oversight for LaTeX forum, I'd say.

I think they are the same ones provided by the original author. I can't remember whether I did any fixes. If this code doesn't work for you, find a way for me to ship the files to you.

Header: (missing a huge amount of stuff, but these linesare the essentials)

\documentclass[a4paper,twoside]{tufte-book} % Use the tufte-book class which in turn uses the tufte-common class
\PassOptionsToPackage{table,dvips,dvipsnames,svgnames,rgb,hyperref}{xcolor}
%\usepackage{pslatex}
\usepackage{tufte-foot} % This is a local style file placed in the build directory. I found it on the internet. 

***snip***
\DeclareCaptionFormat{thikcap}{\pdfrender{TextRenderingMode=2,LineWidth=0.18pt}#1#2#3\par} % custom format of caption to make the characters thicker.

Full width table, caption below:

\begin{tablefw}
    \begin{tabular}{p{3.7cm}p{3.7cm}p{8.0cm}}\arrayrulecolor{white}
        \toprule
        {Name} & {Example} & {Explanation} \\
        \midrule
        {etc} & {etc.} & etc \\

        \bottomrule
    \end{tabular}
    \caption{Caption Here}
\end{tablefw}
\vspace{5ex}

The following produces a full width figure on full page: (I may have been having problems with this figurefw; can't remember. This page used a jpg graphic embedded directly, with caption above figure):

 \begin{figurefw}[t]
           \caption[t]{{\bf Circuit Diagram} plus really long text.}
                \label{fig:big_circuit_problem}
\end{figurefw}
           
            \begin{fullwidth}
                %\vphantom{A}
                \begin{minipage}[]{\textwidth}
                    \vspace{2.5cm}
                    \includegraphics[width=1.5\textwidth]{figures/big_problem_circuit.jpg}\label{test}
                \end{minipage}
            \end{fullwidth}
            \clearpage
            \newpage

@DNF2
Copy link

DNF2 commented Oct 21, 2021

Thank you very much, @Tafnab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants