Tag Info

Hot answers tagged

7

\documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \draw (0,0) -- (0,2) -- (2,2) -- (2,0) -- (0,0); \node[above right] at (0,0) {1}; \node[below right] at (0,2) {2}; \node[below left] at (2,2) {3}; \node[above left] at (2,0) {4}; \end{tikzpicture} \end{document}


6

An automatic and easy way to adapt (following idea of @Benjamin McKay) \documentclass[margin=2mm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[blue,draw=red,thick,minimum width=2cm,minimum height=2cm] (rect) at (0,0) {$\times$}; \foreach \anc/\n in {south west/1,north west/2,north east/3,south east/4}{ \node[anchor=\anc] at ...


5

You can just define a flag macro (to anything) and then not add a new entry if the macro is already defined. % VERSION 1 \iftrue \makeatletter \let\oldref\ref \def\ref#1{% \expandafter\ifx\csname R@#1\endcsname\relax \global\expandafter\let\csname R@#1\endcsname\@empty \immediate\write\@auxout{% \string\gappto\string\ReferencedIDs{#1,}% }% \fi ...


5

Next code shows you some examples: \path [line] (primaryxAODMC) -- (DxAODMC) node[fill=white, pos=0.7, right=2mm]{label A}; draws a line between primaryxAODMC.center and DxAODMC.center and adds a node with text label A to the right of position 0.7 (1 is total path lenght) of this path. The node has a fill=white background which could cover any previous ...


4

Why not simply using the \ref-\label mechanism? \documentclass{article} \usepackage{hyperref} \makeatletter \newcommand{\customlabel}[2]{% \phantomsection \def\@currentlabel{\unexpanded{#2}}\label{#1}% } \makeatother \begin{document} \customlabel{refname}{som\'e text} \ref{refname} \end{document} The accent is just for showing that it doesn't make ...


4

The following example uses the zref referencing system. It defines a new property custom, which is set to the desired contents. \customlabel then stores the contents in the .aux file. \customref extracts the value in an expandable way, thus it can be used in \ifstrequals. An expandable version cannot make warnings, if the reference is undefined, thus this ...


4

Some thing like this? \documentclass[tikz]{standalone} \usetikzlibrary{automata} \begin{document} \begin{tikzpicture}[auto, vertex/.style={circle,draw=black!100,fill=black!100, thick, inner sep=0pt,minimum size=1mm}] \node (v1) at ( 1,1) [vertex,label=left:$v_1$] {}; \node (v2) at ( 0,0) [vertex,label=left:$v_2$] {}; \node (v3) at ( 2,0) ...


4

Quite an easy game for every TeXian drawing solution. By the way, did you try one of them? Here with MetaPost via LuaLaTeX: \documentclass[12pt]{scrartcl} \usepackage{luamplib} \mplibsetformat{metafun} \mplibtextextlabel{enable} \begin{document} \begin{mplibcode} beginfig(1); u = 4cm; draw unitsquare scaled u; label.urt("1", origin); ...


4

The most standard LaTeX (not TeX ;-)) graphic solution: the picture environment. No packages loaded thus. \documentclass[12pt]{scrartcl} \begin{document} \setlength{\unitlength}{4cm} \begin{picture}(1,1) \put(0,0){\framebox(1,1)[t]{}} \put(0.01,0.01){1} \put(0.99,0.01){\makebox(0,0)[br]{2}} \put(0.99,0.99){\makebox(0,0)[tr]{3}} ...


3

Here's quite possibly the strangest approach, using XeLaTeX and fontspec to type the unicode ballot box symbol, resizing it using a \resizebox, and then putting the numbers inside that by manipulating the kerning and alignment. \documentclass{article} \usepackage{fontspec} \newfontfamily{\arial}{Arial Unicode MS} \begin{document} ...


3

The solution based only on TeX primitives (without TikZ, Metapost, Lua etc.): \def\hboxlab#1#2{\hbox to2cm{\vrule height4mm depth1mm \kern1mm #1\hfil #2\kern1mm\vrule}} \vbox{\offinterlineskip\hrule \hboxlab 43 \hbox to2cm{\vrule height1cm \hfil\vrule} \hboxlab 12 \hrule }


3

Just to flood this post ;-) \documentclass[12pt]{scrartcl} \begin{document} \fboxsep2pt \fboxrule1pt \fbox{% \parbox[t][4cm]{4cm}{% 4 \hfill 3 \par\vfill 1 \hfill 2 }% } \begin{tabular*}{4cm}{|@{\,\extracolsep\fill}lr@{\,}|} \hline 4 & 3\\[3cm] 1 & 2\\\hline \end{tabular*} \end{document}


3

This is addicting. Here's a one line answer, using the boxed equation command in the amsmath package: \documentclass{article} \usepackage{amsmath} \begin{document} \[\boxed{1 \kern6ex 2\raisebox{-6.75ex}{\kern-8.25ex 3 \kern5ex 4}}\] \end{document} This is fully functional and technically correct, but not actually intended as a serious answer. ...


3

You have somehow to mark the word you want to refer to: \documentclass{article} \usepackage[a6paper]{geometry} \usepackage[colorlinks]{hyperref} \makeatletter \newcommand{\setword}[2]{% \phantomsection #1\def\@currentlabel{\unexpanded{#1}}\label{#2}% } \makeatother \begin{document} Some text just to see where the link will point to Hi, I ...


3

This can be done with the help of the command \getrefnumber from the refcount package. Define \newcommand{\followref}[1]{\the\numexpr\getrefnumber{#1}+1\relax} and use like in the following example: \documentclass{article} \usepackage{refcount,calc} \newcommand{\followref}[1]{\the\numexpr\getrefnumber{#1}+1\relax} \begin{document} \begin{enumerate} ...


2

I found the solution actually. By selecting the Font Style of Times Roman in MikteX by using package mathptmx And by selecting Label style in Mathematica as LabelStyle -> Directive[ FontFamily -> "Times"] worked for me.


2

Here, I stack inside a simple \framebox. \documentclass{article} \usepackage{stackengine} \begin{document} \stackinset{l}{2pt}{t}{2pt}{4}{% \stackinset{r}{2pt}{t}{2pt}{3}{% \stackinset{r}{2pt}{b}{2pt}{2}{% \stackinset{l}{2pt}{b}{2pt}{1}{% \framebox(50,50){}% }}}} \end{document} If coloring and centermark are useful, \documentclass{article} ...


2

Since nobody has volunteered for it yet, here is a solution with Asymptote, using the aptly named asymptote package. \documentclass[12pt]{scrartcl} \usepackage{asymptote} \begin{document} \begin{asy} unitsize(4cm); draw(unitsquare); label("1", (0, 0), NE); label("2", (1, 0), NW); label("3", (1, 1), SW); label("4", (0, 1), SE); \end{asy} ...


2

Just because nobody has done it yet, here's a solution* using nothing but \vspace, \hspace, and \rule: No packages loaded, and not too many lines of code! \documentclass{article} \begin{document} \noindent\rule{25ex}{.4pt}\\ \hspace*{.25ex} 1 \hspace{19ex} 2 \vspace*{-1.1\baselineskip}\\ \rule{.4pt}{25ex} \hspace{23.265ex} ...


2

Because the question doesn't specify the used format (LaTeX or something else) I give the format-independent answer: \def\A{$a+b=c$} \def\B{$c+d=e$} Warning: The \newcommand is LaTeX specific feature.


2

Assuming that you're using e-TeX, you can tap into \pdfstrcmp for examining strings expandably: This is some regular text. The stored caption is some text. Do: that Do: this \documentclass{article} \newcommand{\customlabel}[1]{\expandafter\gdef\csname#1\endcsname} \newcommand{\getcaption}[1]{\expandafter\csname #1\endcsname} ...


1

\formlabel (i.e. \value{lexemeCounter}}) does not expand to something useful as a name for the \TextField command, so it's ignored and does show nothing. Using \number\value{lexemeCounter} however works. The value must be explicitly changed to a literal number representation for a string label (i.e. a text field name) \documentclass{scrartcl} ...


1

If you just want to change the size of the label numbers, you can use the keyval labelFontSize=\scriptstyle. To use this, you have to load the package pstricks-add. Example: \documentclass{article} \usepackage{pst-plot,pstricks-add} \begin{document} \psset{xunit=1.3cm,yunit=0.6cm,algebraic=true,dotstyle=*,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt ...



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