Skip to content

Instantly share code, notes, and snippets.

@LSinev
Last active September 16, 2020 02:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LSinev/98c0a40e94f4507922a8 to your computer and use it in GitHub Desktop.
Save LSinev/98c0a40e94f4507922a8 to your computer and use it in GitHub Desktop.
Word vs LaTeX image translated into russian, done by tikz code, compilable with pdflatex, xelatex and lualatex in PDF/X. Compilation in xelatex have to be done with commandline like (as PDF 1.3 required by PDF/X): "xelatex.exe -synctex=1 -interaction=nonstopmode -output-driver="xdvipdfmx -V 3 -z 0" --shell-escape %.tex"
% Úτƒ-8 encoded
% http://gist.github.com/LSinev/98c0a40e94f4507922a8
%%% Defining function to check compiler %%%
\RequirePackage{iftex}
\newif\ifxetexorluatex % new if operator (http://tex.stackexchange.com/a/47579/79756)
\ifXeTeX
\xetexorluatextrue
\else
\ifLuaTeX
\xetexorluatextrue
\else
\xetexorluatexfalse
\fi
\fi
%%% Main class setting %%%
\ifXeTeX
%%%%Needs to be compiled with commandline: "xelatex.exe -synctex=1 -interaction=nonstopmode -output-driver="xdvipdfmx -V 3 -z 0" --shell-escape %.tex" % as PDF 1.3 required by PDF/X
\documentclass[crop=true,varwidth,border=0.50001bp]{standalone} % seems working good with PDF/X by xetex
\else
\documentclass[a4paper,12pt]{article}
\pdfobjcompresslevel=0%
\pdfminorversion=3% Setting version of pdf % must be set 3 for PDF 1.3 required by PDF/X
\pdfinclusioncopyfonts=1%
\fi
%%%% Setting options for russian language. Beware of comments in russian
\ifxetexorluatex
\usepackage{polyglossia} % Поддержка многоязычности (fontspec подгружается автоматически)
\setmainlanguage[babelshorthands=true]{russian} % Язык по-умолчанию русский с поддержкой приятных команд пакета babel
\setotherlanguage{english} % Дополнительный язык = английский (в американской вариации по-умолчанию)
\ifXeTeX
\defaultfontfeatures{Ligatures=TeX,Mapping=tex-text}
\else
\defaultfontfeatures{Ligatures=TeX}
\fi
\setmainfont{DejaVu Sans} %% задаёт основной шрифт документа
\newfontfamily\cyrillicfont{DejaVu Sans}
\setsansfont{DejaVu Sans} %% задаёт шрифт без засечек
\newfontfamily\cyrillicfontsf{DejaVu Sans}
\else
\RequirePDFTeX % tests for PDFTEX use and throws an error if a different engine is being used
%%%% Решение проблемы копирования текста в буфер кракозябрами
\input glyphtounicode.tex
\input glyphtounicode-cmr.tex %from pdfx package
\pdfgentounicode=1
%%% Работа с русским языком
\usepackage{cmap} % поиск в PDF
\usepackage[T2A]{fontenc} % кодировка
\usepackage[utf8]{inputenc} % кодировка исходного текста
\usepackage[english,russian]{babel} % локализация и переносы
\fi
\usepackage[bookmarks=false]{hyperref}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\ifXeTeX
\else
\usepackage{dejavu}
\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif
\fi
\ifXeTeX
\else
\usepackage[active,tightpage]{preview} % does not work good with xetex and PDF/X options
\PreviewEnvironment{tikzpicture}
\fi
\usepackage{hyperxmp} % extended pdf options
\hypersetup{%
pdftitle={Word vs. LaTeX},
pdfauthor={Leonid Sinev},
pdfcopyright={This work is licensed under Creative Commons Public Attribution 4.0 International License},
pdfsubject={http://gist.github.com/LSinev/98c0a40e94f4507922a8},
pdfkeywords={Word} {TeX} {LaTeX} {Typesetting},
pdflicenseurl={http://creativecommons.org/licenses/by/4.0/},
pdfmetalang={en}
pdflang={ru},
}
\hypersetup{pdfstartpage={}}% disable openaction of hyperref for PDF/X compliance
\ifXeTeX
%%%%%%%%% PDF-X stuff, IF USING xelatex %%%%%%%%%
%(mm size * 72)/25.4 = bp size
\usepackage{atbegshi}
\AtBeginShipout{% %A hook that is executed for every page
\special{pdf: put @thispage
<<
/TrimBox [0 0 210.990 162.086]
>>
}
}
\special{pdf: put @thispage
<<
/TrimBox [0 0 210.990 162.086]
>>
}
\special{pdf:docinfo
<<
/GTS_PDFXVersion (PDF/X-1:2001)
/GTS_PDFXConformance (PDF/X-1a:2001)
>>
}
\special{pdf:put @catalog
<<
/PageMode /UseNone
/OutputIntents [
<<
/Info (none)
/Type /OutputIntent
/S /GTS_PDFX
/OutputConditionIdentifier (Custom)
/RegistryName (http://www.color.org/)
>>
]
>>
}%
\usepackage{datetime} % for \pdfdate command
\hypersetup{% Setting some more PDF/X stuff for xelatex
pdfinfo={
ModDate={D:\pdfdate},
Trapped={False},
}
}
\else
%%%%%%%%% PDF-X stuff, IF USING pdflatex or lualatex %%%%%%%%%
%(mm size * 72)/25.4 = bp size
\pdfpageattr{ %fill manually
/TrimBox [0 0 210.990 162.086]
}
\pdfinfo{ %for PDF/X
/Title (Word vs. LaTeX) % without this copy of title pdf is not compatible with PDF/X
/GTS_PDFXVersion (PDF/X-1:2001)
/GTS_PDFXConformance (PDF/X-1a:2001)
}%
\pdfcatalog{ %для PDF/X
/PageMode /UseNone
/OutputIntents [
<<
/Info (none)
/Type /OutputIntent
/S /GTS_PDFX
/OutputConditionIdentifier (Custom)
/RegistryName (http://www.color.org/)
>>
]
}%
\fi
\begin{document}
\definecolor{black}{cmyk}{0,0,0,1.0}
\begin{tikzpicture}[y=0.80pt,x=0.80pt,yscale=-1, inner sep=0pt, outer sep=0pt]
\begin{scope}[cm={{1.25,0.0,0.0,-1.25,(0.0,203.96868)}}]% g2993
% image_box
\path[draw=black,line join=miter,line cap=butt,miter limit=22.93,line width=1.8pt] (18.6848,153.6023) -- (211.6447,153.6023) -- (211.6447,18.7560) -- (18.6848,18.7560) -- (18.6848,153.6023) -- cycle;
% path_latex
\path[draw=black,line join=miter,line cap=butt,miter limit=22.93,line width=1.3pt] (18.6848,47.3895) .. controls (120.8069,45.4148) and (211.7150,121.8650) .. (211.7150,121.8650);
% Arrow_Horizontal
\path[draw=black,line join=miter,line cap=butt,miter limit=10.00,line width=1.3pt,tips,-{Stealth[length=3.5mm,width=2mm]}] (91.6221,13.8765) -- (137.7324,13.8765);
% Arrow_Vertical
\path[draw=black,line join=miter,line cap=butt,miter limit=10.00,line width=1.3pt,tips,-{Stealth[length=3.5mm,width=2mm]}] (13.5874,62.6365) -- (13.5874,108.7468);
% path_office
\path[draw=black,dash pattern=on 5.5mm off 4mm,line join=miter,line cap=butt,line width=1.3pt] (18.6485,23.9172) .. controls (108.2355,40.2963) and (115.4807,146.1790) .. (115.4104,153.6467);
% Test Grid
% \draw[step=5.0mm,gray,very thin] (0mm,0mm) grid (60mm,50mm);
% Text_Office
\path[shift={(17.0mm,30.0mm)},fill=black] (0,0) node[above right] (Text_Office) {\large{Word}};
% Text_LaTeX
\path[shift={(43.0mm,18.0mm)},fill=black] (0,0) node[above right] (Text_LaTeX) {\large\LaTeX};
% Text_complexity
\path[shift={(10.0mm,0.0mm)},fill=black, font={\fontsize{9.5pt}{9.5pt}\selectfont}] (0,0) node[above right] (Text_complexity) {Сложность и размер документа};
% Text_effort
\path[shift={(3.0mm,5.0mm)},fill=black, font={\fontsize{9.5pt}{9.5pt}\selectfont}] (0,0) node[above right, rotate=90] (Text_effort) {Усилия и затраты времени};
% Text_impossible
\path[shift={(25.0mm,44.0mm)},fill=black, font={\fontsize{7.0pt}{7.0pt}\selectfont}] (0,0) node[above right] (Text_impossible) {Невозможное};
\end{scope}
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment