3

I would like to define a style (e. g. style=techDraw) that gives me the possibility to define the behavior of all technical drawings made by tikz or imported as pdf_tex a. s. o. when the style techDraw is set for this graphic.

It should enable a standardized font (in my case DIN EN ISO 3098 approximated by osifont.ttf), a font size that varies by the paper format (e. g. 7 mm height for DIN A4) and proper parsing of all appearing numbers by siuntix

For example a drawing like this shall be taken. And also a graphic I exported from inkscape with pdf and text separated. I would like to get settings like this:

%The following commands are invented and not serving as an MWE
\documentclass[tikz]{standalone}
\usepackage{siunitx}
\usepackage{ifthen}
\defineGraphicsStyle{techDraw/.style=
{\sisetup{mode=text, parse-numbers=true},
\setmainfont{osifont},
% some if-else routine to change fontsize (if papersize = A4 set fontsize = 7mm else...)
%maybe some function telling latex, that all text should be treated as math input. 
%Include "$ $" to all text fields. 
\tikzset{font=osifont}}}

\begin{document}
\begin[style=techDraw]{tikzpicture}
%some nodes with input such as dimensions "15000", angles "\ang{90}", 
%symbols "\alpha" or units "\SI{5}{\kilogram}"
\end{tikzpicture}
%
\begin[style=techDraw]{figure}
\input{someInkscapeDrawing.pdf_tex}
%it would be easier not to write "$ $" and "\num" when constructing the original svg. 
%Therefore same settings as above would be useful.
\end{figure}
\end{document}

I'm very sorry for such ugly code. I just want to give some ideas of what I imagine and don't know how to implement. The idea for that is to get a template for ISO-conform drawings in each thesis.


While trying around (for a single graphic as I don't know how to set it globally without affecting other fonts) I got a problem with siunitx. The included MWE shows, that the "dot" and "comma" symbol of my font is not used by the \num{} operation.

\documentclass{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[]{siunitx}
\usepackage{xltxtra,fontspec,xunicode}
\setmainfont{osifont}
%
\begin{document}
%
\noindent 123456789.0\\
\num{123456789.0}\\
123456789,0\\
\sisetup{locale=DE}
\num{123456789,0}
%
\end{document}
David Carlisle
  • 757,742
LaRiFaRi
  • 43,807
  • 2
    You might link to the osifont. Regarding your problem, the text mode of siunitx helps with the font issue: \num[mode=text]{123456789,0} – Qrrbrbirlbel Jul 02 '13 at 15:33
  • That works indeed. Could you explain to me, why that behaves like that? I just have one font; Why are numbers taken from it, but seperators aren't? For my style template I would like to remove all siuntix-commands and let the numbers be parsed automatically. – LaRiFaRi Jul 02 '13 at 15:45
  • 1
    The default value for mode is math which means that it uses the math font. For some reason, siunitx chooses the text font for digits (even in math-mode itself). The mode option (which should be applied consistently with \sisetup) forces always text-mode. You need to go in more detail what you mean by “style template”. What (or who) should parse your numbers automatically? I am also missing the connection to TikZ here. Can you extend your question? – Qrrbrbirlbel Jul 02 '13 at 16:14
  • Edited my OP. Excuse the mess, code is meant as a brain storm serving for discussion. – LaRiFaRi Jul 02 '13 at 20:54
  • 4
    I'm voting to close this question as off-topic because it's marked as solved by the comments by OP – Moriambar Jun 08 '17 at 23:28

0 Answers0