Tag Info

Hot answers tagged

36

Use \fbox{% \pdfsavepos\write-1{hello is at \the\pdflastxpos,\the\pdflastypos}% hello% } and the log file will have the coordinates in scaled points The above produces a line such as the following in the log file: hello is at 10005380,43282099


24

It is no different to asking why two java executables use the same java runtime. plain tex and latex both need a tex engine to execute the code, they differ in which format file (ie a memory dump of definitions) they load. Classically that was specified by a commandline argument tex &plain v tex &latex but as a convenience web2c implementations can ...


19

Here is a possible solution via TikZ: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \newcommand\mybox{% \begin{tikzpicture}[remember picture] \draw (0,0) rectangle (.6em,.6em); \path let \p1=($(.3em,.3em) - (current page.south west)$) in \pgfextra{ \pgfmathsetmacro\xpos{\x1/1cm} \pgfmathsetmacro\ypos{\y1/1cm} ...


12

You need to expand and let LaTeX know that you mean a control sequence \documentclass{article} \usepackage{amssymb} \usepackage{pgffor} \foreach \x in {C,N,Q,Z,D,R,T}{\expandafter\xdef\csname\x\x\endcsname{\noexpand\mathbb{\x}}} \begin{document} \foreach \x in {C,N,Q,Z,D,R,T}{$\csname\x\x\endcsname$} \end{document}


11

TeX uses fixed point binary arithmetic and calc uses this arithmetic that can't guarantee great accuracy. You get a better result using implementations of floating point numbers, for example the one in expl3: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \DeclareExpandableDocumentCommand{\roundtointeger}{m} { \fp_eval:n { round ( #1, 0 ) } ...


10

You're better served with expl3: \documentclass{article} \usepackage{amsmath,amssymb} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\makeabbrev}{mmm} { \yoruk_makeabbrev:nnn { #1 } { #2 } { #3 } } \cs_new_protected:Npn \yoruk_makeabbrev:nnn #1 #2 #3 { \clist_map_inline:nn { #3 } { \cs_new_protected:cpn { #2 } { #1 { ##1 } } } } ...


10

Use \and to separate authors. \documentclass{article} \title{Group Project - Project Specification} \author{Anna Laura \and John Batty \and John Friend \and Jack Cridland \and Kamil Lewinsky \and Leon Hassan \and Punit Shah \and Rowan Alexander} \begin{document} \maketitle \end{document} If you want more, look in to authblk package.


8

The example if fixed by braces around the problematic UTF-8 character inside the text for decorate: text={|\myshift| T{ự} do} Otherwise the text would be scanned byte by byte and disrupting the multi-byte UTF-8 character.


7

The main point of this task is usage of pdfTeX primitives \pdfsavepos, \pdflastxpos, \pdflastypos. You can create a macro \saveposition which saves the actual position to the file \jobname.pos in the form: 1: 67.65254mm, 267.37009mm 2: 101.77405mm, 267.37009mm 3: 67.65254mm, 261.73753mm 4: 101.77405mm, 261.73753mm The number of the checkbox is here ...


7

When you do \newcommand{\foo}{bar}, the command \show\foo will tell you > \foo=\long macro: ->bar. When you say \def{\FOO}{bar} you get > \FOO=macro: ->bar. Then \ifx\foo\FOO would evaluate to false, because one macro is long and the other one isn't. If you plan to use \def in the command line, use \newcommand* which doesn't make \long ...


6

You can reduce the letterspace with microtype (why the encoding=* is needed is one of its mysteries) \documentclass[11pt]{article} \usepackage[tracking]{microtype} \usepackage{lipsum} \DeclareMicrotypeSet*[tracking]{ttfonts}{ family=tt*} \SetTracking{encoding=*}{ -100 } \begin{document} \lipsum[1] \ttfamily \lipsum[1] \end{document} You can also change ...


5

The navigator package allows access to links, attachments and other PDF features in Plain TeX, LaTeX and ConteXt. If you add \input navigator to your preamble and \finishpdffile to the end of your document, you can attach a file to your document with \embeddedfile[<description>]{<object name>}[<alternate file name>]{<file>} ...


5

If you call pdflatex with the command line option -halt-on-error, the process will terminate at the first error.


5

The simple answer is, I'm afraid, that there does not appear to be an elsbook document class (or any other book-type document class provided by Elsevier).


5

The tex executable runs the “original Knuth TeX”, whereas \pdfpagewidth is a pdftex primitive. The usual \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname pdfpagewidth\endcsname\relax \else \pdfpagewidth 8.5 truein \pdfpageheight 11 truein \fi will do. After it, \pdfpagewidth and \pdfpageheight will not be ...


5

No. The \special there is not understood by tex at all it is just passed verbatim into the dvi file to whatever program process that file. That particular syntax is for the dvips driver, it would not necessarily be understood by other dvi to ps or dvi to pdf/svg/... programs and viewers. You can of course hide the platform differences behind macros giving ...


4

You have too many $ characters! The cases environment is in math mode, as well as equation*, so you should type \begin{equation*} \theta = \begin{cases} \eta & \widehat{P} < \bar{P}\\ \eta & \widehat{P} > \bar{P} \end{cases} \label{eq: test} \end{equation*} If you want to add text to the side conditions, you can use ...


4

In general, to debug a big document where I don't have a clue to the origin of the error, I place an \end{document} right after the \begin{document} and see if it compiles. If not, the problem is in the preamble. If it compiles, then I start moving the \end{document} downward in the document, in successive fashion, making sure not to insert it ...


3

While creating my minimal working example, I realized my mistake. LaTeX displays the table of contents using the .toc file that is built on the first pass through the document. Therefore, the first pass will not include the chapters that were not processed from before. To fix this issue, run the LaTeX command used to process the .tex file again. This will ...


3

You can use the lscape package: Code: \documentclass{article} \usepackage{lscape} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{landscape} \lipsum[1] \end{landscape} \end{document}


3

In the text section of the .pdf file \\ is interpreted correctly, but the compilation process complains about unallowed characters in PDFString. It's possible to force \texorpdfstring{\\}{^^J} with the TeX - primitive ^^J newline which at least is interpreted as a link break in the keywords section. In addition, the hyperref manual recommends to specify ...


3

You need to declare the layers and the two missing styles. Not sure what the style defintions should be so I just set them to draw thick lines: Code: \documentclass{article} \usepackage{tikz} %% -------------------------------------- Declare the layers \pgfdeclarelayer{nodelayer} \pgfdeclarelayer{edgelayer} \pgfsetlayers{edgelayer,nodelayer,main} %% ...


3

It makes no sense to view the dvi output. It cannot show rotations and also sometimes not the correct image size. Use always the pdf output which should be upside down and cropped. latex <file> dvips -o <file>.ps <file> ps2pdf -dAutoRotatePages=/None <file>.ps However, the easiest way is to run xelatex, it does the conversion ...


3

Here is a fontspec way to get the equals sign in a separate font in text mode, if you compile with LuaLaTeX or XeLaTeX. \documentclass{article} \usepackage{lmodern} \renewcommand*\familydefault{\sfdefault} % Use sans as base font \usepackage{fontspec} \newfontfamily{\mymathfont}{Latin Modern Math} % Family for math symbols ...


3

There's a list of available T2A fonts with Cyrillic glyphs here. You can test them and choose the one you like best. Here's an example. \documentclass{article} \usepackage[T2A]{fontenc} \usepackage[utf8]{inputenc} \usepackage{droid} % <- one of the fonts with T2A encoding \begin{document} \noindent А а Б б В в Г г Д д Е е Ж ж З ...


3

If you are really doing a picture (although your example sure looks like a table), then probably is best done to use a modern drawing package such astikz: Code: \documentclass{report} \usepackage{tikz} \newcommand*{\NodeWidth}{1.0cm}% \newcommand*{\NodeHeight}{1.0cm}% \tikzset{My Node Style/.style={rectangle, ultra thick, minimum width=\NodeWidth, ...


2

This one uses matrix \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix} \tikzset{ table/.style={ matrix of nodes, row sep=-\pgflinewidth, column sep=-\pgflinewidth, nodes={rectangle,minimum size = 1cm,align=center,inner sep=0pt}, text depth=1.25ex, text height=2.5ex, nodes in empty cells }, } \begin{document} ...


2

My best guess is that you did not install the forloop.sty file correctly, but just save it to the folder, where you have your project. If this is the case, it will work with pdflatex, as pdflatex will install search you current directory for .sty files, but LyX will not. To install a package you have to choices. You can use the texlive install utitlity, if ...


2

Here is a complementary list of fonts that can be used with pdfLaTeX/XeLaTeX/LuaLaTeX, that are not mentioned in the above link: Sans serif fonts: Cabin, Linux Biolinum, MyriadPro. Serif fonts: Heuristica and Erewhon (based on Adobe Utopia), ebgaramond, Xcharter (based on Bitstream Charter), Linux Libertine, MinionPro. All these font are available in ...


2

The \mintinline command is provided by the development version of minted, not the one in the current TeX distributions. If you want to use it, manually install the development version. You can instead use pythontex: \documentclass{book} \usepackage{pythontex} \begin{document} Abc \pygment{vala}|main| def \end{document} This requires running pythontex ...



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