Tag Info

Hot answers tagged formatting

9

Using \pgfmathparse is problematic for this question because integer division fails with a "Dimension too large" error around 16500. In particular, without some additional care, any solution using \pgfmathparse will not be able to cope with the OP's example of 18249 because this number is too large. For large (integer) calculations the xint family of ...

8

You can do it with expl3 and its fp module. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\duration}{m} { \didou_duration:n { #1 } } \fp_new:N \l_didou_duration_hrs_fp \fp_new:N \l_didou_duration_min_fp \fp_new:N \l_didou_duration_sec_fp \cs_new_protected:Nn \didou_duration:n { \fp_compare:nTF { #1 < 60 } {% ...

7

Here is a solution using apnum package: \input apnum \def\duration#1{{\apFRAC=0 % "/" means integer division \def\zero{0}% \evaldef\S{#1/1}% \S: number of seconds (without fraction part) \evaldef\H{\S/3600}% \H: number of hours \evaldef\Hrest{\S - 3600*\H}% \Hrest: number of seconds without hours ...

7

As pointed out by Andrew, pgfmath cannot by default cannot handle numbers larger than 16383.99999; however, the pgfmath library can handle floating point numbers thereby allowing (nearly) arbitrarily large numbers to be handled. The limitation then becomes the precision, and ultimately certain digits are truncated. Floating Point Version This function ...

6

(Updated the Lua code after the OP clarified that rounding rather than truncation should be applied to the seconds in the duration calculations.) Here's a LuaLaTeX-based solution. The preamble sets up both a Lua function named formatted_duration and a TeX macro named \fdur. The TeX macro takes one argument (the duration in seconds and fractions of a ...

6

Logical markup is always possible with a \newcommand{...}[1]{...} and using grouping to prevent leaking of font declarations or color settings into the rest of code. For more sophisticated approaches I recommend however appropiate packages for the relevant purpose. For code markup, there are minted, listings and tcolorbox (with its listings features) ...

5

The first equation below features the frational term shifted down so that the fraction bar is at the same height as the lower horizontal stroke of the summation symbol. The second equation features a more standard look. Speaking for myself, I'd go with the look of the second equation. \documentclass{article} \usepackage{amsmath,amsfonts} ...

4

Assuming you're using one of the "standard" LaTeX document classes (article, report, book) or a document class that's based on one of the standard classes, you could load the sectsty package and issue the directive \subsubsectionfont{\normalfont\itshape} in the preamble. \documentclass{article} \usepackage{sectsty} ...

4

Here is a solution based on atbegshi and answers packages. The idea is to use answers that write contents of theorem, lemma to an external file (mtfile.tex), discard all pages (all contents of the main file http://tex.stackexchange.com/a/267555/71471) and then use the external file to output only theorems. We use a newif test \onlytrue for only theorem and ...

3

You can do that withetoolbox and the explicitoption of titlesec. Also note that if you want to use starred subsections, you can have a different formatting with the numberless key: \documentclass{article} \usepackage[explicit]{titlesec} \usepackage{etoolbox} \newcounter{artikel} \setcounter{artikel}{1} \renewcommand{\thesubsection}{\arabic{artikel}} ...

3

Already many good and diverse answers. I am adding one for another completely expandable macro. Complete expandability's constraint saves us from having to cook up names for temporary macros. In the code below, one could make \Duration@i recursive and obtain in this way an expandable macro for conversion to sexagesimal notation, with arbitrary big integers ...

2

you had defined a fancy page style but commented out the use of that style, and even if it were uncommented you had over-written it multiple times with the empty and plain styles. Also there were several error and unclosed groups reported. \documentclass[12pt, oneside, a4paper, leqno]{report} \linespread{1.5} \usepackage{geometry} ...

2

By default footnotes start at the end of the text block so if the page is not full the space required to pad the page comes below the notes. This seems natural enough to me but if you want the padding space to come between the text block and the footnotes then you can use \usepackage[bottom]{footmisc}

1

You have a simple solution with titlesec: \documentclass{article} \usepackage{titlesec} \titleformat{\section}{\bfseries\Large}{\thesection.}{0.5em}{} \titleformat{\subsubsection}{}{\thesubsubsection}{1em}{\itshape} \begin{document} \section{section} \subsection{subsection} \subsubsection{subsubsection} \end{document}

1

Assuming that you do not need the star versions of the \section et al: \documentclass[12pt]{report} \usepackage{csuf-thesis} \usepackage{hyperref} \hypersetup{colorlinks=false} \nocopyright \setcounter{secnumdepth}{0} \makeatletter \def\section#1{\@startsection{section}{1}{\z@} {-7ex}{2ex \@plus 0.01ex} {\centering\ssp}{\underline{#1}}} ...

1

Very basic, not much can be done here. Otherwise customize the itemize list with enumitem package to provide other typesetting facilities. \documentclass{article} \begin{document} \begin{description} \item Foo We have something to say here \item Foobar We have to say something differently here \end{description} \end{document}

Only top voted, non community-wiki answers of a minimum length are eligible