Hi,
I have a question on defining an own float style (not sure if this is the right place to post it, I'm new here). I want to have a ruled float but with two rules only instead of three (without the upper rule).
I tried to add the following to my preamble but I'm getting errors (Missing \begin{document}. \newcommand\fs@m and Undefined control sequence. ...f\@fs@cfont{\bfseries}\let\@fs@capt\floatc)
this is the definition:
\newcommand\fs@myruled{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@ruled
\def\@fs@post{\kern2pt\hrule\relax}%
\def\@fs@mid{\kern2pt\hrule\kern2pt}%
\let\@fs@iftopcapt\iftrue}
How do I have to do it, is the definition simply in the wrong place?
Thanks for any help
Conny
Document Classes ⇒ How to define a new float style?
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to define a new float style?
Do not take this detour. Try one of the packages float, floatrow or trivfloat. With the help of these packages defining new floats is much easier.
Best regards and welcome to the board
Thorsten¹
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: How to define a new float style?
Thanks,
the floatrow package actually lets me do what I want.
In case somebody wants to know:
\includepackage{floatrow}
\DeclareFloatStyle{MyRuled}{
capposition=top,
midcode=rule,
postcode=lowrule,
heightadjust=all}
\newfloat{sentences}{th}{los}[chapter]
\floatname{sentences}{Example sentences}
\floatsetup[sentences]{style=MyRuled}
\usepackage[hang,small,bf,nooneline]{caption}
Just one more question:
if I define a new rule \DeclareFloatVCode{grayrule}{{\color{gray}\rule\hsize{1pt}}} and use it instead of the regular rule, the caption moves upwards. Why is that and how can I avoid it?
the floatrow package actually lets me do what I want.
In case somebody wants to know:
\includepackage{floatrow}
\DeclareFloatStyle{MyRuled}{
capposition=top,
midcode=rule,
postcode=lowrule,
heightadjust=all}
\newfloat{sentences}{th}{los}[chapter]
\floatname{sentences}{Example sentences}
\floatsetup[sentences]{style=MyRuled}
\usepackage[hang,small,bf,nooneline]{caption}
Just one more question:
if I define a new rule \DeclareFloatVCode{grayrule}{{\color{gray}\rule\hsize{1pt}}} and use it instead of the regular rule, the caption moves upwards. Why is that and how can I avoid it?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to define a new float style?
Since I never worked with floatrow, I can't figure out what's going wrong. A minimal working example (MWE) would make working out a solution much easier.c0nny wrote:[…] if I define a new rule \DeclareFloatVCode{grayrule}{{\color{gray}\rule\hsize{1pt}}} and use it instead of the regular rule, the caption moves upwards. Why is that and how can I avoid it?
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10