Hot answers tagged

17

You can use eso-pic to place content in the ForeGround in the centre of every page: \documentclass{article} \usepackage{eso-pic,xcolor,lipsum} \AddToShipoutPictureFG{% \AtPageCenter{% \color{red}% \makebox[0pt]{\rule{250pt}{2pt}}% \makebox[0pt]{\rule[-250pt]{2pt}{500pt}}% }% } \begin{document} \lipsum[1-50] \end{document}


12

You could use the standalone class in combination with a minipage of the same width as the text in your main document: \documentclass{standalone} \usepackage{lipsum} \begin{document} \begin{minipage}{345pt} \lipsum[2] \end{minipage} \end{document} To find out what the width of the text in your main document is, the showdim package offers the \tenthpt ...


11

For example, there is a paragraph with four lines, two lines are at the bottom of the column A and two lines are at the top of the next column B. Then, one or more words are removed with the result that TeX breaks the paragraph in three lines instead of four. The document has set \clubpenalty and \widowpenalty to 10000 to prevent widows and orphans (page ...


10

Use pdfcrop: \documentclass{article} \usepackage{lipsum} % for mock text \pagestyle{empty} % no page ornaments \begin{document} \lipsum[1] \end{document} Save this as shortdoc.tex and run pdflatex shortdoc pdfcrop shortdoc This will produce shortdoc-crop.pdf, that you can include with \includegraphics.


10

I prefer an implementation with expl3, which is a bit complicated by the mixture with TikZ. \documentclass{article} \usepackage{tikz} %\usepackage{xparse} % not needed for LaTeX 2020-10-01 or later %Define macros for drawing every 0-9 numbers at unit place \NewDocumentCommand{\cistercianzero}{}{\draw[black, thick] (0,-0.5)--(0, 0.5)} \NewDocumentCommand{\...


9

default fraction of text on a page require more space than it is available on page with your big picture. this ratio you can change with \renewcommand{\textfraction}{0.07}. so try the following: \documentclass{article} \usepackage[showframe]{geometry} \usepackage{graphicx} \renewcommand{\textfraction}{0.07} % allow minimal text w. figs \usepackage{lipsum} ...


9

Define a suitable counter representation that expands to three digits: add a 0 if the number is less than 100 and a further one if the number is less than 10. \documentclass{article} \usepackage[a6paper,bottom=2cm]{geometry} % for small pictures \makeatletter \newcommand{\arabicthree}[1]{\expandafter\@arabicthree\csname c@#1\endcsname} \newcommand{\@...


8

You can almost never accurately reference the page counter from within the main document, only during the output routine where the page being shipped out is accurately known. Luatex does not change the basic model of the way TeX pages are output so the same applies in luatex. In your lua loop you can use mcount=mycount+1 tex.print('\\includegraphics{...


7

Page numbers are typically inserted as part of the page style. An empty page style removes both header and footer from your document, which is probably what happened here. Remove \pagestyle{empty} from your code in order to restore the page numbering.


7

Welcome to TeX.SE.! As far as I know, a .pdf or .dvi file can not have such a functionality (for whole pages). But it can have it for comments... something that I suppose is not enough for you. If you open any pdf (or dvi) by using any viewer of your system, you will see that all the pages are visible. So, the I don't think you can do it with just a pdf or ...


7

One solution could be xr-hyper: curriculum.tex: \documentclass[twocolumn]{article} \usepackage{xr-hyper} \usepackage[colorlinks,allcolors=blue]{hyperref} \externaldocument{001} \externaldocument{002} \usepackage{nameref} \parindent0pt \begin{document} \section*{\em\centering Curriculum vitae} \ref{pub}. \nameref{pub} \dotfill \pageref{pub}\par \ref{books}...


7

Overview As noted elsewhere, columnsets cannot be mixed with regular text. As such, the given approach will not work as expected. Also, mixedcolumns do not provide the ability for unequal columns. The following changes resolve the issues: Use the newcolumnsets module, also known as page grids Ensure that the layout is using grids Remove the illustration ...


7

There are differences between how the width of a tcolorbox environment and a \draw grid are determined. In a tcolorbox environment, its total natural width is exactly \linewidth. Here the entire left and right rules are drawn within that width. In a \draw (0, 0) grid (1, 1);, its total width is "1cm + line width", because tikz draws a line with ...


7

The whole thing using TikZ After one commenter asked why I didn't do the whole titlepage in TikZ, I couldn't find rest until I've tried. Here is the result. I'm sure, the left aligned positioning in the center can be optimized. If anyone knows how, just drop me a line and I'll edit. The code is a lot shorter and cleaner now: \documentclass{article} \...


5

I suppose your MWE is something like \documentclass[10pt,b5paper,dvipdfmx]{jreport} \begin{document} foo \end{document} and typeset this using pLaTeX and dvipdfmx, which indeed produces an A4-sized PDF. The reason for this is that the b5paper option just tells jreport to lay out the content in a B5-sized domain but is not related to the actual page size of ...


5

\xpatchcmd (from xpatch) has the same format/interface than its counterpart \patchcmd (from etoolbox): \xpatchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>} \xpatchcmd searches for <search> in <cmd> and replaces it with <replace>. If this search-and-replace is successful, it executes <success>, ...


5

You can rotate and displace the shipout box. But you can't rotate the "pdf background", the pdf reference allows only multiples of 90. \documentclass[a4paper,12pt]{article} \usepackage{lipsum} \usepackage{graphicx,atbegshi} \begin{document} \lipsum \AtBeginShipoutNext{% \setbox\AtBeginShipoutBox=\hbox{% \rotatebox{35}{\hspace{-4cm}\box\AtBeginShipoutBox}% ...


5

Regarding the \put(0,0){\line(3,-0.35){4}} inside the picture environment of your example, it is a failed attempt to draw a line of length 4 (expressed in terms of \unitlength) starting from point (0,0) and going in direction (3,-0.35). This can't work well, because: you haven't specified the value of \unitlength, thus you get the default of 1pt (combined ...


5

Basing on the answer of muzimuzhi Z, I suggest a variant with a single box which integrates drawing the grid: \documentclass[a4paper]{article} % DINA4 (210 × 297 [mm]) \usepackage[%showframe=true, width=16cm, height=26cm, ]{geometry} \pagestyle{empty} \usepackage{tikz} \usepackage[most]{tcolorbox} \begin{document} \newlength{\gridlinewidth} \setlength{\...


5

You can use the shipout hooks. But you will have to adjust the values to your needs - the starting point is the left upper corner (so I had to use -10pt to get the text on the page). \documentclass{book} \usepackage{lipsum} \begin{document} \AddToHook{shipout/background}[mypic] { \put(0,-\textheight){0, -textheight} \put(\textwidth,-\textheight){...


4

Note the use of the undocumented feature of \includegraphics. \documentclass{article} \usepackage{pdfpages} \newlength{\tempwidth} \begin{document} \settowidth{\tempwidth}{\includegraphics[page=1]{lipsum.pdf}} \includepdf[fitpaper,pages=1,trim={0 0 {.5\tempwidth} 0},clip]{lipsum.pdf} % *** \end{document}


4

This works for me: \documentclass{article} \usepackage{graphicx} \usepackage[export]{adjustbox} \begin{document} \centering % just to avoid overfull box \includegraphics[page=2,max size={\textwidth}{0.9\textheight}]{l3fp} \end{document}


4

Use \vspace*{\fill} instead of \vspace*{18cm} at the beginning of the titlepage environment. The 18cm are to high and so the (unneeded?) \\ results in a page break. \documentclass [paper=a4, % A4 twoside=off, % nicht doppelseitig setzen DIV=13, % Vordefinierte Seitenränder (15=min, 0=max) fontsize=12pt, % default font size BCOR=15.0mm, % ...


4

If I understand you rightly, then you can use the standard memoir commands to change the document page layout. The only catch is that the size of the type set text block isn't automatically changed by memoir. Changing this mid-document can be a bit tricky, but you can copy what the geometry package does to do this provided you also surround things with a ...


4

There are two complications here. Firstly, every call to \directlua runs immediately, so if you want TeX's usual processing to happen, you need to relinquish control to TeX (and use coroutines or something). So when you have \directlua{for i = 1, 60 do tex.print(tex.count['c@page']) tex.print([[\par]]) end} } as in the question, this simply puts 60 ...


4

This is a very basic solution which just reads the value of the LaTeX counter page in Lua (printing is for testing, but the tex.count statement can be used at other places as well). \documentclass{article} \newcommand\printluapage{% \directlua{tex.print(tex.count['c@page'])} } \begin{document} \printluapage\clearpage\printluapage\clearpage\...


4

The problem of interleaving is partly solved in ConTeXt. You can access the page number from within Lua and it is updated at some point but the problem David described in his comment persists. \starttext \startluacode for i = 1, 60 do context(context.currentpage) context.par() end \stopluacode \stoptext


4

Here it goes :) I created two macros: \startpreview and \endpreview. Their behavior: Everything after a \startpreview will be written to the output pdf. Everything starting from the page after an \endpreview will be discarded, unless a \startpreview overrides this. How they work: I defined two counters (I couldn't make it work with a \newif, for some ...


4

I'm adding another answer because the previous one almost works and because it is a completely different approach. I defined the same two commands; \startpreview and \endpreview. Their behavior: The \startpreview macro defines a \prevpage macro that holds the current page number. The \endpreview macro will complete this page range crating a macro with ...


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